[PATCH] net: ravb: Fix NULL pointer access

Michal Simek michal.simek at xilinx.com
Tue Sep 15 16:23:55 CEST 2020



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 <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;
>  }
> 

Make sense.

Reviewed-by: Michal Simek <michal.simek at xilinx.com>

Thanks,
Michal


More information about the U-Boot mailing list