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:
committed by
Tom Rini
parent
2ad98ab8f6
commit
4e18429883
@@ -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 */
|
||||
|
Reference in New Issue
Block a user