Re: [PATCH v3 7/8] net: phy: Add support to configure clock in Broadcom iProc mdio mux
From: Andrew Lunn <andrew@lunn.ch>
Date: 2018-08-01 22:18:21
Also in:
linux-arm-kernel, lkml, netdev
From: Andrew Lunn <andrew@lunn.ch>
Date: 2018-08-01 22:18:21
Also in:
linux-arm-kernel, lkml, netdev
quoted
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. AndrewI 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