From: Sergei Shtylyov Date: Tue, 19 Mar 2013 13:41:32 +0000 (+0000) Subject: sh_eth: check TSU registers ioremap() error X-Git-Tag: Ubuntu-5.2.0-15.16~16027^2~23 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=fc0c0900408e05758a0df17c1924ca837fafca5e;p=mirror_ubuntu-eoan-kernel.git sh_eth: check TSU registers ioremap() error One must check the result of ioremap() -- in this case it prevents potential kernel oops when initializing TSU registers further on... Signed-off-by: Sergei Shtylyov Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index c87862812ead..bf5e3cf97c4d 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c @@ -2446,6 +2446,11 @@ static int sh_eth_drv_probe(struct platform_device *pdev) } mdp->tsu_addr = ioremap(rtsu->start, resource_size(rtsu)); + if (mdp->tsu_addr == NULL) { + ret = -ENOMEM; + dev_err(&pdev->dev, "TSU ioremap failed.\n"); + goto out_release; + } mdp->port = devno % 2; ndev->features = NETIF_F_HW_VLAN_FILTER; }