Re: [PATCH 1/3] net: fec: Remove redundant checks for NULL clk pointer

Lothar Waßmann
2015-12-01T07:24:16Z

Hi,

> From: Lothar Waßmann <LW@KARO-electronics.de> Sent: Monday, November 30, 2015 7:33 PM
> > To: Andrew Lunn; David S. Miller; Estevam Fabio-R49496; Greg Ungerer;
> > Kevin Hao; Lothar Waßmann; Lucas Stach; Duan Fugang-B38611; Philippe
> > Reynes; Richard Cochran; Russell King; Sascha Hauer; Stefan Agner; linux-
> > kernel@vger.kernel.org; netdev@vger.kernel.org; Jeff Kirsher; Uwe Kleine-
> > König
> > Subject: [PATCH 1/3] net: fec: Remove redundant checks for NULL clk
> > pointer
> >
> > NULL is a valid argument to clk_enable()/clk_disable(). Remove redundant
> > checks before calling those functions.
> >
> > Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
> > ---
> > drivers/net/ethernet/freescale/fec_main.c | 23 +++++++++--------------
> > 1 file changed, 9 insertions(+), 14 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/freescale/fec_main.c
> > b/drivers/net/ethernet/freescale/fec_main.c
> > index d2328fc..e17d74f 100644
> > --- a/drivers/net/ethernet/freescale/fec_main.c
> > +++ b/drivers/net/ethernet/freescale/fec_main.c
> > @@ -1873,35 +1873,30 @@ static int fec_enet_clk_enable(struct net_device
> > *ndev, bool enable)
> > }
> > mutex_unlock(&fep->ptp_clk_mutex);
> > }
> > - if (fep->clk_ref) {
> > - ret = clk_prepare_enable(fep->clk_ref);
> > - if (ret)
> > - goto failed_clk_ref;
> > - }
> > +
> > + ret = clk_prepare_enable(fep->clk_ref);
> > + if (ret)
> > + goto failed_clk_ref;
>
> If you want to clean up the code, pls also remove "fep->clk_enet_out" check in this brace.
>
I would have to reintroduce it in the later patch to frame the call to
fec_reset_phy().

Lothar Waßmann