diff options
author | Jean-Jacques Hiblot | 2019-10-01 14:03:26 +0200 |
---|---|---|
committer | Tom Rini | 2019-10-31 07:22:53 -0400 |
commit | 4e1842988364446ba0cf2171d1eebb53c15bc44e (patch) | |
tree | dc5536f60fab7fc0a5ab37106c09c4302cd97c3d /include/generic-phy.h | |
parent | 2ad98ab8f68c71e2db140c6d5f1020aa6fbacb9e (diff) |
drivers: phy: Handle gracefully NULL pointers
For some controllers PHYs can be optional. Handling NULL pointers without
crashing nor failing, makes it easy to handle optional PHYs.
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Diffstat (limited to 'include/generic-phy.h')
-rw-r--r-- | include/generic-phy.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/generic-phy.h b/include/generic-phy.h index 947c582f68b..95caf583413 100644 --- a/include/generic-phy.h +++ b/include/generic-phy.h @@ -270,7 +270,7 @@ static inline int generic_phy_get_by_name(struct udevice *user, const char *phy_ */ static inline bool generic_phy_valid(struct phy *phy) { - return phy->dev != NULL; + return phy && phy->dev; } #endif /*__GENERIC_PHY_H */ |