Alternative formula for the Bernoulli pmf? If I understand correctly, a Bernoulli pmf just needs to assign a probability $p$ if there is a success $(x=1)$, and $1-p$ otherwise $(x = 0)$. Rather than the usual formula, can't the following function also satisfy this condition and represent a the pmf of a Bernoulli RV?
$
f(x) = xp + (1-x)(1-p).
$
So if $f(x=1) = p, f(x=0) = 1-p.$
What would be wrong in formulating it this way?

This is fine, assuming that the domain of $f$ is $\{0,1\}$.
This is also true of the formulations in the other answers.
A different formulation involving the Iverson bracket is
\begin{align*}
f(x) = (1-p)[x=0]+p[x=1].\tag{1}
\end{align*}
One defines
\begin{align*}
[P] &= \begin{cases}
1, & \textrm{if $P$ is true}, \\
0, & \textrm{else.}
\end{cases}
\end{align*}
The Iverson bracket has many interesting algebraic properties that capture the logic of the statement $P$. One interesting difference with formulation (1) is that the domain of $f$ can be thought of as all of $\mathbb{Z}$ (or indeed all of $\mathbb{R}$).
This allows one to be loose with notation in a way that is totally rigorous.
For example, the expected value of $g(x)$ is
$$\sum_x g(x)f(x),$$
where the sum is typically understood to be over all of $\mathbb{Z}$, with the result
$$g(0)(1-p) + g(1)p.$$
