Hi Fabio, On 23.08.2016 05:01, Fabio Estevam wrote: > From: Fabio Estevam <fabio.este...@nxp.com> > > clk_prepare_enable() may fail, so we should better check its return > value and propagate it in the case of failure. > > Signed-off-by: Fabio Estevam <fabio.este...@nxp.com> > --- > drivers/net/ethernet/nxp/lpc_eth.c | 29 ++++++++++++++++++++++------- > 1 file changed, 22 insertions(+), 7 deletions(-) > > diff --git a/drivers/net/ethernet/nxp/lpc_eth.c > b/drivers/net/ethernet/nxp/lpc_eth.c > index 4d4ecba..7c796f7 100644 > --- a/drivers/net/ethernet/nxp/lpc_eth.c > +++ b/drivers/net/ethernet/nxp/lpc_eth.c > @@ -475,12 +475,19 @@ static void __lpc_get_mac(struct netdata_local *pldat, > u8 *mac) > mac[5] = tmp >> 8; > } > > -static void __lpc_eth_clock_enable(struct netdata_local *pldat, bool enable) > +static int __lpc_eth_clock_enable(struct netdata_local *pldat, bool enable) > { > - if (enable) > - clk_prepare_enable(pldat->clk); > - else > + int ret; > + > + if (enable) { > + ret = clk_prepare_enable(pldat->clk); > + if (ret) > + return ret; > + } else { > clk_disable_unprepare(pldat->clk); > + } > + > + return 0; > }
The change is correct, but let me ask you to replace all instances of __lpc_eth_clock_enable() with plain clk_prepare_enable() or clk_disable_unprepare(). It should save one redundant error check also. -- With best wishes, Vladimir