1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 16:52:14 +02:00

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>
This commit is contained in:
Jean-Jacques Hiblot
2019-10-01 14:03:26 +02:00
committed by Tom Rini
parent 2ad98ab8f6
commit 4e18429883
2 changed files with 26 additions and 6 deletions

View File

@@ -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 */