mirror of
https://github.com/torvalds/linux
synced 2024-09-21 11:38:48 +00:00
net: moxa: Use devm_platform_get_and_ioremap_resource()
Use devm_platform_get_and_ioremap_resource() to simplify code and avoid a null-ptr-deref by checking 'res' in it. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
7f553ff214
commit
35cba15a50
|
@ -481,13 +481,12 @@ static int moxart_mac_probe(struct platform_device *pdev)
|
||||||
priv->ndev = ndev;
|
priv->ndev = ndev;
|
||||||
priv->pdev = pdev;
|
priv->pdev = pdev;
|
||||||
|
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
priv->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
|
||||||
ndev->base_addr = res->start;
|
|
||||||
priv->base = devm_ioremap_resource(p_dev, res);
|
|
||||||
if (IS_ERR(priv->base)) {
|
if (IS_ERR(priv->base)) {
|
||||||
ret = PTR_ERR(priv->base);
|
ret = PTR_ERR(priv->base);
|
||||||
goto init_fail;
|
goto init_fail;
|
||||||
}
|
}
|
||||||
|
ndev->base_addr = res->start;
|
||||||
|
|
||||||
spin_lock_init(&priv->txlock);
|
spin_lock_init(&priv->txlock);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue