From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michal Simek Date: Tue, 15 Sep 2020 16:23:55 +0200 Subject: [PATCH] net: ravb: Fix NULL pointer access In-Reply-To: <20200915141038.3371-1-biju.das.jz@bp.renesas.com> References: <20200915141038.3371-1-biju.das.jz@bp.renesas.com> Message-ID: <95fb3cfe-e219-a34a-b2f4-5120ea356842@xilinx.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 15. 09. 20 16:10, Biju Das wrote: > 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 > Reviewed-by: Lad Prabhakar > --- > 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; > } > Make sense. Reviewed-by: Michal Simek Thanks, Michal