Skip to content

Commit 57fe147

Browse files
khoroshilovdavem330
authored andcommitted
smsc911x: Add check for ioremap_nocache() return code
There is no check for return code of smsc911x_drv_probe() in smsc911x_drv_probe(). The patch adds one. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8f44c9a commit 57fe147

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/net/ethernet/smsc/smsc911x.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2467,6 +2467,10 @@ static int smsc911x_drv_probe(struct platform_device *pdev)
24672467
pdata = netdev_priv(dev);
24682468
dev->irq = irq;
24692469
pdata->ioaddr = ioremap_nocache(res->start, res_size);
2470+
if (!pdata->ioaddr) {
2471+
retval = -ENOMEM;
2472+
goto out_ioremap_fail;
2473+
}
24702474

24712475
pdata->dev = dev;
24722476
pdata->msg_enable = ((1 << debug) - 1);
@@ -2572,6 +2576,7 @@ static int smsc911x_drv_probe(struct platform_device *pdev)
25722576
smsc911x_free_resources(pdev);
25732577
out_request_resources_fail:
25742578
iounmap(pdata->ioaddr);
2579+
out_ioremap_fail:
25752580
free_netdev(dev);
25762581
out_release_io_1:
25772582
release_mem_region(res->start, resource_size(res));

0 commit comments

Comments
 (0)