* [PATCH] 3c59x: handle pci_iomap() errors
@ 2010-07-21 12:00 Kulikov Vasiliy
2010-07-22 21:11 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Kulikov Vasiliy @ 2010-07-21 12:00 UTC (permalink / raw)
To: kernel-janitors
Cc: Steffen Klassert, David S. Miller, Eric Dumazet, Ben Hutchings,
Alexey Dobriyan, Joe Perches, netdev
pci_iomap() can fail, handle this case and return -ENOMEM from probe
function.
Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
---
drivers/net/3c59x.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index 069a03f..9b137e1 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -1020,6 +1020,11 @@ static int __devinit vortex_init_one(struct pci_dev *pdev,
ioaddr = pci_iomap(pdev, pci_bar, 0);
if (!ioaddr) /* If mapping fails, fall-back to BAR 0... */
ioaddr = pci_iomap(pdev, 0, 0);
+ if (!ioaddr) {
+ pci_disable_device(pdev);
+ rc = -ENOMEM;
+ goto out;
+ }
rc = vortex_probe1(&pdev->dev, ioaddr, pdev->irq,
ent->driver_data, unit);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] 3c59x: handle pci_iomap() errors
2010-07-21 12:00 [PATCH] 3c59x: handle pci_iomap() errors Kulikov Vasiliy
@ 2010-07-22 21:11 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-07-22 21:11 UTC (permalink / raw)
To: segooon
Cc: kernel-janitors, klassert, eric.dumazet, ben, adobriyan, joe,
netdev
From: Kulikov Vasiliy <segooon@gmail.com>
Date: Wed, 21 Jul 2010 16:00:36 +0400
> pci_iomap() can fail, handle this case and return -ENOMEM from probe
> function.
>
> Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Applied.
We seem to leak the iomaps if vortex_probe1() fails, feel free to fix
that too :-)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-07-22 21:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-21 12:00 [PATCH] 3c59x: handle pci_iomap() errors Kulikov Vasiliy
2010-07-22 21:11 ` 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).