From: Kulikov Vasiliy on
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.

Signed-off-by: Kulikov Vasiliy <segooon(a)gmail.com>
---
drivers/usb/gadget/goku_udc.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c
index 1088d08..d62e214 100644
--- a/drivers/usb/gadget/goku_udc.c
+++ b/drivers/usb/gadget/goku_udc.c
@@ -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 */
--
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/