Message ID | 1496044664-13297-4-git-send-email-patrice.chotard@st.com |
---|---|
State | Not Applicable |
Headers | show |
On 29 May 2017 at 01:57, <patrice.chotard@st.com> wrote: > From: Patrice Chotard <patrice.chotard@st.com> > > 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> > --- > > v4: _ ensure that phy->dev is set to NULL in case of > generic_phy_get_by_index() fails > > drivers/phy/phy-uclass.c | 2 ++ > 1 file changed, 2 insertions(+) > Reviewed-by: Simon Glass <sjg@chromium.org>
diff --git a/drivers/phy/phy-uclass.c b/drivers/phy/phy-uclass.c index 0d8bef7..5edc80c 100644 --- a/drivers/phy/phy-uclass.c +++ b/drivers/phy/phy-uclass.c @@ -46,6 +46,8 @@ 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 = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev_of_offset(dev), "phys", "#phy-cells", 0, index, &args);