public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] net: ravb: Fix NULL pointer access
@ 2020-09-15 14:10 Biju Das
  2020-09-15 14:23 ` Michal Simek
  2020-09-16 13:53 ` Marek Vasut
  0 siblings, 2 replies; 13+ messages in thread
From: Biju Das @ 2020-09-15 14:10 UTC (permalink / raw)
  To: u-boot

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@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-09-21 16:26 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-15 14:10 [PATCH] net: ravb: Fix NULL pointer access Biju Das
2020-09-15 14:23 ` Michal Simek
2020-09-16 13:53 ` Marek Vasut
2020-09-16 15:43   ` Biju Das
2020-09-16 21:30     ` Marek Vasut
2020-09-18 15:26       ` Biju Das
2020-09-19  2:48         ` Marek Vasut
2020-09-19 11:14           ` Biju Das
2020-09-19 12:44             ` Marek Vasut
2020-09-19 18:14               ` Biju Das
2020-09-19 19:12                 ` Marek Vasut
2020-09-20  7:34                   ` Biju Das
2020-09-21 16:26                     ` Marek Vasut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox