On 02/03/2014 09:13 PM, Andrew Lunn wrote:
The common clock framework considers NULL a valid clock
reference. This makes handling optional clocks simple, in that if the
optional clock is not available, a NULL reference can be used in the
place of a real clock, simplifying the clock consumer.
Extend this concept to the phy consumer API. A NULL can be passed to
the release calls, the phy_init() and phy_exit() calls, and
phy_power_on() and phy_power_off() and a NOP is performed.
Signed-off-by: Andrew Lunn <andrew@xxxxxxx>
[...]
When the controller no longer needs the PHY, it has to release the reference
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index 645c867c1257..56535253e50c 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
[...]
@@ -308,6 +320,9 @@ err0:
*/
void phy_put(struct phy *phy)
{
+ if (!phy)
+ return;
+
if (IS_ERR(phy))
return;
Why not merge these two?
Hi Sergei
Have you heard Russell King talk about IS_ERR_NULL()?
Probably not but I didn't think of it actually, just:
if (!phy || IS_ERR(phy))
return;
PS: BTW, I'm not sure why phy_put() has to handle error pointers...
Andrew
WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html