[PATCH] net: ravb: Fix NULL pointer access

Marek Vasut marek.vasut at gmail.com
Wed Sep 16 23:30:17 CEST 2020


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.


More information about the U-Boot mailing list