drivers: net: fsl_ls_mdio: prevent a NULL pointer dereference
Prevent a NULL pointer dereference in the probe path by checking the return valud of dev_read_addr_ptr() against NULL. Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
This commit is contained in:
parent
cfbd388ae7
commit
878a20aa15
|
|
@ -124,6 +124,9 @@ static int fsl_ls_mdio_probe(struct udevice *dev)
|
||||||
struct memac_mdio_controller *regs;
|
struct memac_mdio_controller *regs;
|
||||||
|
|
||||||
priv->regs_base = dev_read_addr_ptr(dev);
|
priv->regs_base = dev_read_addr_ptr(dev);
|
||||||
|
if (!priv->regs_base)
|
||||||
|
return -ENODEV;
|
||||||
|
|
||||||
regs = (struct memac_mdio_controller *)(priv->regs_base);
|
regs = (struct memac_mdio_controller *)(priv->regs_base);
|
||||||
|
|
||||||
memac_setbits_32(®s->mdio_stat,
|
memac_setbits_32(®s->mdio_stat,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue