usb: goku_udc: fix error path
Subsystems (2)
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.
Signed-off-by Kulikov Vasiliy <[email protected]>
--- drivers/usb/gadget/goku_udc.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
drivers/usb/gadget/goku_udc.c +6 -2
@@ -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