aboutsummaryrefslogtreecommitdiff
path: root/drivers/phy
diff options
context:
space:
mode:
authorPatrice Chotard2017-07-18 11:38:42 +0200
committerMarek Vasut2017-07-28 23:34:04 +0200
commitb9688df3cbf4bf92fa96e1cc9ff7be510e06b54b (patch)
treed6d6899965ad1075bf2411539182e4430545df14 /drivers/phy
parent576e3cc700c598487fed741ee85103373a3f69d6 (diff)
drivers: phy: Set phy->dev to NULL when generic_phy_get_by_index() fails
phy->dev need to be set to NULL in case of generic_phy_get_by_index() fails. Then phy->dev can be used to check if the phy is valid Reported-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/phy')
-rw-r--r--drivers/phy/phy-uclass.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/phy/phy-uclass.c b/drivers/phy/phy-uclass.c
index d8b8d58e44f..68e518fc790 100644
--- a/drivers/phy/phy-uclass.c
+++ b/drivers/phy/phy-uclass.c
@@ -45,6 +45,7 @@ int generic_phy_get_by_index(struct udevice *dev, int index,
debug("%s(dev=%p, index=%d, phy=%p)\n", __func__, dev, index, phy);
assert(phy);
+ phy->dev = NULL;
ret = dev_read_phandle_with_args(dev, "phys", "#phy-cells", 0, index,
&args);
if (ret) {