summaryrefslogtreecommitdiff
path: root/include/generic-phy.h
diff options
context:
space:
mode:
authorJean-Jacques Hiblot <jjhiblot@ti.com>2019-10-01 15:03:26 +0300
committerTom Rini <trini@konsulko.com>2019-10-31 14:22:53 +0300
commit4e1842988364446ba0cf2171d1eebb53c15bc44e (patch)
treedc5536f60fab7fc0a5ab37106c09c4302cd97c3d /include/generic-phy.h
parent2ad98ab8f68c71e2db140c6d5f1020aa6fbacb9e (diff)
downloadu-boot-4e1842988364446ba0cf2171d1eebb53c15bc44e.tar.xz
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.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/generic-phy.h b/include/generic-phy.h
index 947c582f68..95caf58341 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 */