Solving this problem by the method of characteristic curves we have to solve the ODE
$$\frac{\mathrm{d}y}{\mathrm{d}x} = \frac{y}{x}$$
which gives us $$C = \ln(y/x)$$
where $C$ is constant.
Therefore, the solution should be
$$u(x,y) = f(\ln(y/x))$$
We can go further by noting that $e^C$ is also a constant which we can name $C_2$ giving us
$$C_2 = y/x$$
and the solution would give
$$u(x,y) = f(y/x)$$
Are both solutions valid?
They are the same solution but not the same function to express it. Using the same name for both functions is confusing. Call the second $g$, so $f(\ln(x/y))=g(x/y)$ For any chosen $f$ we have determined $g$ as $g=f\circ \ln$