mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 3/7] usb: goku_udc: fix error path
@ 2010-07-31 17:38 Kulikov Vasiliy
  0 siblings, 0 replies; only message in thread
From: Kulikov Vasiliy @ 2010-07-31 17:38 UTC (permalink / raw)
  To: kernel-janitors
  Cc: David Brownell, Greg Kroah-Hartman, Dan Carpenter,
	Németh Márton, linux-usb, linux-kernel

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@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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-07-31 17:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-31 17:38 [PATCH 3/7] usb: goku_udc: fix error path Kulikov Vasiliy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®