Skip to contentSkip to conversation

usb: goku_udc: fix error path

PATCH Superseded Kulikov Vasiliy 1 participant 1 message Jul 31, 2010

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 3/7 usb: goku_udc: fix error path

create_proc_read_entry() may fail, if so return -ENOMEM. Also call pci_set_drvdata() a bit earlier as private data is used in cleanup code.

---
 drivers/usb/gadget/goku_udc.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
drivers/usb/gadget/goku_udc.c +6 -2
index 1088d08..d62e214 100644
@@ -1784,6 +1784,7 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 		retval = -ENOMEM;
 		goto done;
 	}
+	pci_set_drvdata(pdev, dev);
 
 	spin_lock_init(&dev->lock);
 	dev->pdev = pdev;
@@ -1821,7 +1822,6 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	}
 	dev->regs = (struct goku_udc_regs __iomem *) base;
 
-	pci_set_drvdata(pdev, dev);
 	INFO(dev, "%s\n", driver_desc);
 	INFO(dev, "version: " DRIVER_VERSION " %s\n", dmastr());
 	INFO(dev, "irq %d, pci mem %p\n", pdev->irq, base);
@@ -1841,7 +1841,11 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 
 #ifdef CONFIG_USB_GADGET_DEBUG_FILES
-	create_proc_read_entry(proc_node_name, 0, NULL, udc_proc_read, dev);
+	if (create_proc_read_entry(proc_node_name, 0, NULL,
+			    udc_proc_read, dev) = NULL) {
+		retval = -ENOMEM;
+		goto done;
+	}
 #endif
 
 	/* done */
Signature · 1 line
1.7.0.4