Commit c7d83024 authored by Wei Yongjun's avatar Wei Yongjun Committed by David S. Miller

net: korina: Fix return value check in korina_probe()

In case of error, the function devm_platform_ioremap_resource_byname()
returns ERR_PTR() and never returns NULL. The NULL test in the return
value check should be replaced with IS_ERR().

Fixes: b4cd249a ("net: korina: Use devres functions")
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 65e302a9
...@@ -1315,23 +1315,23 @@ static int korina_probe(struct platform_device *pdev) ...@@ -1315,23 +1315,23 @@ static int korina_probe(struct platform_device *pdev)
lp->tx_irq = platform_get_irq_byname(pdev, "tx"); lp->tx_irq = platform_get_irq_byname(pdev, "tx");
p = devm_platform_ioremap_resource_byname(pdev, "emac"); p = devm_platform_ioremap_resource_byname(pdev, "emac");
if (!p) { if (IS_ERR(p)) {
printk(KERN_ERR DRV_NAME ": cannot remap registers\n"); printk(KERN_ERR DRV_NAME ": cannot remap registers\n");
return -ENOMEM; return PTR_ERR(p);
} }
lp->eth_regs = p; lp->eth_regs = p;
p = devm_platform_ioremap_resource_byname(pdev, "dma_rx"); p = devm_platform_ioremap_resource_byname(pdev, "dma_rx");
if (!p) { if (IS_ERR(p)) {
printk(KERN_ERR DRV_NAME ": cannot remap Rx DMA registers\n"); printk(KERN_ERR DRV_NAME ": cannot remap Rx DMA registers\n");
return -ENOMEM; return PTR_ERR(p);
} }
lp->rx_dma_regs = p; lp->rx_dma_regs = p;
p = devm_platform_ioremap_resource_byname(pdev, "dma_tx"); p = devm_platform_ioremap_resource_byname(pdev, "dma_tx");
if (!p) { if (IS_ERR(p)) {
printk(KERN_ERR DRV_NAME ": cannot remap Tx DMA registers\n"); printk(KERN_ERR DRV_NAME ": cannot remap Tx DMA registers\n");
return -ENOMEM; return PTR_ERR(p);
} }
lp->tx_dma_regs = p; lp->tx_dma_regs = p;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment