summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sgi
diff options
context:
space:
mode:
authorTang Bin <tangbin@cmss.chinamobile.com>2020-05-20 11:55:32 +0200
committerDavid S. Miller <davem@davemloft.net>2020-05-22 02:26:54 +0200
commita7654211d0ffeaa8eb0545ea00f8445242cbce05 (patch)
tree1035541121ddc67b58de30c1f632a07f8926d89a /drivers/net/ethernet/sgi
parentnet: don't return invalid table id error when we fall back to PF_UNSPEC (diff)
downloadlinux-a7654211d0ffeaa8eb0545ea00f8445242cbce05.tar.xz
linux-a7654211d0ffeaa8eb0545ea00f8445242cbce05.zip
net: sgi: ioc3-eth: Fix return value check in ioc3eth_probe()
In the function devm_platform_ioremap_resource(), if get resource failed, the return value is ERR_PTR() not NULL. Thus it must be replaced by IS_ERR(), or else it may result in crashes if a critical error path is encountered. Fixes: 0ce5ebd24d25 ("mfd: ioc3: Add driver for SGI IOC3 chip") Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/sgi')
-rw-r--r--drivers/net/ethernet/sgi/ioc3-eth.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/ethernet/sgi/ioc3-eth.c b/drivers/net/ethernet/sgi/ioc3-eth.c
index 7305e8e86c51..6646eba9f57f 100644
--- a/drivers/net/ethernet/sgi/ioc3-eth.c
+++ b/drivers/net/ethernet/sgi/ioc3-eth.c
@@ -848,14 +848,14 @@ static int ioc3eth_probe(struct platform_device *pdev)
ip = netdev_priv(dev);
ip->dma_dev = pdev->dev.parent;
ip->regs = devm_platform_ioremap_resource(pdev, 0);
- if (!ip->regs) {
- err = -ENOMEM;
+ if (IS_ERR(ip->regs)) {
+ err = PTR_ERR(ip->regs);
goto out_free;
}
ip->ssram = devm_platform_ioremap_resource(pdev, 1);
- if (!ip->ssram) {
- err = -ENOMEM;
+ if (IS_ERR(ip->ssram)) {
+ err = PTR_ERR(ip->ssram);
goto out_free;
}