提交 fc0c0900 编写于 作者: S Sergei Shtylyov 提交者: David S. Miller

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: NSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 0582b7d1
...@@ -2446,6 +2446,11 @@ static int sh_eth_drv_probe(struct platform_device *pdev) ...@@ -2446,6 +2446,11 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
} }
mdp->tsu_addr = ioremap(rtsu->start, mdp->tsu_addr = ioremap(rtsu->start,
resource_size(rtsu)); 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; mdp->port = devno % 2;
ndev->features = NETIF_F_HW_VLAN_FILTER; ndev->features = NETIF_F_HW_VLAN_FILTER;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册