netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] smsc911x: Add check for ioremap_nocache() return code
@ 2017-07-12 20:58 Alexey Khoroshilov
  2017-07-12 21:36 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Khoroshilov @ 2017-07-12 20:58 UTC (permalink / raw)
  To: Steve Glendinning; +Cc: Alexey Khoroshilov, netdev, linux-kernel, ldv-project

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 <khoroshilov@ispras.ru>
---
 drivers/net/ethernet/smsc/smsc911x.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index ea1bbc355b4d..0b6a39b003a4 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -2467,6 +2467,10 @@ static int smsc911x_drv_probe(struct platform_device *pdev)
 	pdata = netdev_priv(dev);
 	dev->irq = irq;
 	pdata->ioaddr = ioremap_nocache(res->start, res_size);
+	if (!pdata->ioaddr) {
+		retval = -ENOMEM;
+		goto out_ioremap_fail;
+	}
 
 	pdata->dev = dev;
 	pdata->msg_enable = ((1 << debug) - 1);
@@ -2572,6 +2576,7 @@ static int smsc911x_drv_probe(struct platform_device *pdev)
 	smsc911x_free_resources(pdev);
 out_request_resources_fail:
 	iounmap(pdata->ioaddr);
+out_ioremap_fail:
 	free_netdev(dev);
 out_release_io_1:
 	release_mem_region(res->start, resource_size(res));
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] smsc911x: Add check for ioremap_nocache() return code
  2017-07-12 20:58 [PATCH] smsc911x: Add check for ioremap_nocache() return code Alexey Khoroshilov
@ 2017-07-12 21:36 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-07-12 21:36 UTC (permalink / raw)
  To: khoroshilov; +Cc: steve.glendinning, netdev, linux-kernel, ldv-project

From: Alexey Khoroshilov <khoroshilov@ispras.ru>
Date: Wed, 12 Jul 2017 23:58:56 +0300

> 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 <khoroshilov@ispras.ru>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-07-12 21:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-12 20:58 [PATCH] smsc911x: Add check for ioremap_nocache() return code Alexey Khoroshilov
2017-07-12 21:36 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).