]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
sh_eth: check TSU registers ioremap() error
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Tue, 19 Mar 2013 13:41:32 +0000 (13:41 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 20 Mar 2013 16:17:59 +0000 (12:17 -0400)
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 <sergei.shtylyov@cogentembedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/renesas/sh_eth.c

index c87862812ead7820e548fe22d482b304d76c2d4d..bf5e3cf97c4d89d55b92b66a46ee37787acb934c 100644 (file)
@@ -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;
        }