I am attempting to show that the function $f(p)$, defined as \begin{align*} f(p) = \frac{1}{p^{n-m}(1-p)^m} \end{align*} is convex in $p$ on $(0,1)$ for all integers $0\le m\le n$.
Context
Let $x\in\{0,1\}^n$. A vector $x$ is generated at each iteration by (independently) sampling each bit; $x_i=1$ w.p. $p$ and $x_i = 0$ w.p. $1-p$. The function $f(p)$ represents the expected number of iterations until we obtain a vector $x$ with $n-m$ ones and $m$ zeros.
My attempt
We can write the second derivative of $f(p)$ as \begin{align} f''(p) = \frac{-(m-1)m}{p^{n-m}(1-p)^{m+2}}+\frac{2m(m-n)}{p^{n-m+1}(1-p)^{m+1}}+\frac{(m-n-1)(m-n)}{p^{n-m+2}(1-p)^{m}} \end{align} Using the above, we find that showing convexity of $f$ boils down to showing that \begin{align*} -(m-1)mp^{n-m+1}+2m(m-n)p^{n-m}(1-p)^m+(m-n-1)(m-n)(1-p)^{m+1} \end{align*} is positive for all $p\in(0,1)$ and $0\le m\le n$. I haven't been able to do this since it gets pretty messy.
Question
How would one go about showing that $f(p)$ is convex in $p$ on $(0,1)$ for all integers $0\le m\le n$?
Function $g$ is convex $\implies$ $e^g$ is convex.
Now $\ln f$ is the sum of convex functions and thus is convex. We obtain the desired result using the first paragraph.