]> git.karo-electronics.de Git - linux-beck.git/commitdiff
usb: Make usb_hcd_pci_probe labels more descriptive.
authorSarah Sharp <sarah.a.sharp@linux.intel.com>
Fri, 15 Oct 2010 17:33:48 +0000 (10:33 -0700)
committerSarah Sharp <sarah.a.sharp@linux.intel.com>
Mon, 14 Mar 2011 01:07:14 +0000 (18:07 -0700)
Make the labels for the goto statements in usb_hcd_pci_probe()
describe the cleanup they do, rather than being numbered err[1-4].
This makes it easier to add error handling later.

The error handling for this function looks a little fishy, since
set_hs_companion() isn't called until the very end of the function, and
clear_hs_companion() is called if this function fails earlier than that.
But it should be harmless to clear a NULL pointer, so leave the error
handling as-is.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
drivers/usb/core/hcd-pci.c

index d37088591d9af2d085c93e20d6a2d3c032f5a3da..88d9109b4b459fc536a63fa421aee9e4e814ae69 100644 (file)
@@ -192,13 +192,13 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
                        "Found HC with no IRQ.  Check BIOS/PCI %s setup!\n",
                        pci_name(dev));
                retval = -ENODEV;
-               goto err1;
+               goto disable_pci;
        }
 
        hcd = usb_create_hcd(driver, &dev->dev, pci_name(dev));
        if (!hcd) {
                retval = -ENOMEM;
-               goto err1;
+               goto disable_pci;
        }
 
        if (driver->flags & HCD_MEMORY) {
@@ -209,13 +209,13 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
                                driver->description)) {
                        dev_dbg(&dev->dev, "controller already in use\n");
                        retval = -EBUSY;
-                       goto err2;
+                       goto clear_companion;
                }
                hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len);
                if (hcd->regs == NULL) {
                        dev_dbg(&dev->dev, "error mapping memory\n");
                        retval = -EFAULT;
-                       goto err3;
+                       goto release_mem_region;
                }
 
        } else {
@@ -236,7 +236,7 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
                if (region == PCI_ROM_RESOURCE) {
                        dev_dbg(&dev->dev, "no i/o regions available\n");
                        retval = -EBUSY;
-                       goto err2;
+                       goto clear_companion;
                }
        }
 
@@ -244,24 +244,24 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
 
        retval = usb_add_hcd(hcd, dev->irq, IRQF_DISABLED | IRQF_SHARED);
        if (retval != 0)
-               goto err4;
+               goto unmap_registers;
        set_hs_companion(dev, hcd);
 
        if (pci_dev_run_wake(dev))
                pm_runtime_put_noidle(&dev->dev);
        return retval;
 
- err4:
+unmap_registers:
        if (driver->flags & HCD_MEMORY) {
                iounmap(hcd->regs);
- err3:
+release_mem_region:
                release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
        } else
                release_region(hcd->rsrc_start, hcd->rsrc_len);
- err2:
+clear_companion:
        clear_hs_companion(dev, hcd);
        usb_put_hcd(hcd);
- err1:
+disable_pci:
        pci_disable_device(dev);
        dev_err(&dev->dev, "init %s fail, %d\n", pci_name(dev), retval);
        return retval;