From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Wed, 16 Sep 2020 23:30:17 +0200 Subject: [PATCH] net: ravb: Fix NULL pointer access In-Reply-To: References: <20200915141038.3371-1-biju.das.jz@bp.renesas.com> <0ae44ba9-0781-906d-537e-f1e115ccd903@gmail.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 9/16/20 5:43 PM, Biju Das wrote: > Hi Marek, Hi, [...] >>> +++ 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); >> >> Shouldn't we rather move this into the PHY driver altogether ? > > If I fix, the phydriver with empty function, compiler will complain about unused parameter right? > What about other phy's which doesn't have this callback. I mean, should we not move this entire code which configures something in a Micrel PHY, and is specific to Micrel PHY, into the Micrel PHY driver and remove the whole call of writeext from this ethernet driver ? >> I _think_ this might be specific to some Micrel PHY. > As mentioned in the commit message, it is seen with Realtek phy(rtl8211e) and crash seen on Hihope RZ/G2M board. Right, because that writeext seems to be micrel-phy specific.