[PATCH] net: ravb: Fix NULL pointer access
Biju Das
biju.das.jz at bp.renesas.com
Tue Sep 15 16:10:38 CEST 2020
Some phy's like rtl8211e do not support writeext() callback. Add a check to
avoid null pointer access before calling writeext() callback.
Signed-off-by: Biju Das <biju.das.jz at bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj at bp.renesas.com>
---
drivers/net/ravb.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ravb.c b/drivers/net/ravb.c
index 886f53ee82..623d377897 100644
--- a/drivers/net/ravb.c
+++ b/drivers/net/ravb.c
@@ -438,7 +438,8 @@ static int ravb_config(struct udevice *dev)
writel(mask, eth->iobase + RAVB_REG_ECMR);
- phy->drv->writeext(phy, -1, 0x02, 0x08, (0x0f << 5) | 0x19);
+ if (phy->drv->writeext)
+ phy->drv->writeext(phy, -1, 0x02, 0x08, (0x0f << 5) | 0x19);
return 0;
}
--
2.17.1
More information about the U-Boot
mailing list