Re: [PATCH v3 7/8] net: phy: Add support to configure clock in Broadcom iProc mdio mux
From: Andrew Lunn
Date: Wed Aug 01 2018 - 18:18:21 EST
> > As Florian pointed out, the clk_ API is happy to take a NULL pointer
> > for a clock. So you don't need this last else.
> >
> > Andrew
> >
> I do return with an error from the probe if the clk_prepare_enable() fails,
> so I was calling the prepare with a valid clock.
How many times do we need to say it?
NULL is a valid clock.
int clk_prepare(struct clk *clk)
{
if (!clk)
return 0;
return clk_core_prepare_lock(clk->core);
}
int clk_enable(struct clk *clk)
{
if (!clk)
return 0;
return clk_core_enable_lock(clk->core);
}
clk_prepare_enable(NULL) returns 0, which is not an error.
Andrew