Skip to contentSkip to conversation

3c59x: handle pci_iomap() errors

PATCH Applied Kulikov Vasiliy 2 participants 2 messages Jul 21, 2010 – Jul 22, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 3c59x: handle pci_iomap() errors

pci_iomap() can fail, handle this case and return -ENOMEM from probe function.

---
 drivers/net/3c59x.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/net/3c59x.c +5 -0
index 069a03f..9b137e1 100644
@@ -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);
Signature · 1 line
1.7.0.4
maintainer Applied
#1 lore raw

From: Kulikov Vasiliy <[email protected]>
Date: Wed, 21 Jul 2010 16:00:36 +0400

Quoted 4 lines

pci_iomap() can fail, handle this case and return -ENOMEM from probe function.

Applied.

We seem to leak the iomaps if vortex_probe1() fails, feel free to fix that too :-)