Re: [PATCH] net: ethernet: ravb: Fix release of refclk

From: Adam Ford
Date: Wed Apr 21 2021 - 12:03:41 EST


On Wed, Apr 21, 2021 at 9:25 AM Sergei Shtylyov
<sergei.shtylyov@xxxxxxxxx> wrote:
>
> On 4/21/21 5:05 PM, Adam Ford wrote:
>
> > The call to clk_disable_unprepare() can happen before priv is
> > initialized.
>
> This still doesn't make sense for me...
>
I need an external reference clock enabled by a programmable clock so
I added functionality to turn it on. [1] When I did it, I was
reminded to disable the clock in the event of an the error condition.
I originally added a call to clk_disable_unprepare(priv->refclk)
under the label called out_release, but a bot responded to me that we
may jump to this error condition before priv is initialized.

This fix is supposed to create a new label so the errors that happen
after the refclk is initialized will get disabled, but any errors that
happen before the clock is initialized will handle errors like they
did before.

Does that help explain things better?

adam

[1] - https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=8ef7adc6beb2ef0bce83513dc9e4505e7b21e8c2

> > This means moving clk_disable_unprepare out of
> ^ call
> > out_release into a new label.
> >
> > Fixes: 8ef7adc6beb2 ("net: ethernet: ravb: Enable optional refclk")
> > Signed-off-by: Adam Ford <aford173@xxxxxxxxx>
>
> Reviewed-by: Sergei Shtylyov <sergei.shtylyov@xxxxxxxxx>
>
>
> [...]
>
> MBR, Sergei