diff options
author | Sarah Sharp <sarah.a.sharp@linux.intel.com> | 2010-10-15 13:33:48 -0400 |
---|---|---|
committer | Sarah Sharp <sarah.a.sharp@linux.intel.com> | 2011-03-13 21:07:14 -0400 |
commit | 8766c815607e572556b04075d4545330123c4f27 (patch) | |
tree | 04a1b0589c0c194baf87fb57cb243ef39e94419e /drivers/usb/core | |
parent | b02d0ed677acb3465e7600366f2353413bf24074 (diff) |
usb: Make usb_hcd_pci_probe labels more descriptive.
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>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r-- | drivers/usb/core/hcd-pci.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index d37088591d9..88d9109b4b4 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
@@ -192,13 +192,13 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
192 | "Found HC with no IRQ. Check BIOS/PCI %s setup!\n", | 192 | "Found HC with no IRQ. Check BIOS/PCI %s setup!\n", |
193 | pci_name(dev)); | 193 | pci_name(dev)); |
194 | retval = -ENODEV; | 194 | retval = -ENODEV; |
195 | goto err1; | 195 | goto disable_pci; |
196 | } | 196 | } |
197 | 197 | ||
198 | hcd = usb_create_hcd(driver, &dev->dev, pci_name(dev)); | 198 | hcd = usb_create_hcd(driver, &dev->dev, pci_name(dev)); |
199 | if (!hcd) { | 199 | if (!hcd) { |
200 | retval = -ENOMEM; | 200 | retval = -ENOMEM; |
201 | goto err1; | 201 | goto disable_pci; |
202 | } | 202 | } |
203 | 203 | ||
204 | if (driver->flags & HCD_MEMORY) { | 204 | if (driver->flags & HCD_MEMORY) { |
@@ -209,13 +209,13 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
209 | driver->description)) { | 209 | driver->description)) { |
210 | dev_dbg(&dev->dev, "controller already in use\n"); | 210 | dev_dbg(&dev->dev, "controller already in use\n"); |
211 | retval = -EBUSY; | 211 | retval = -EBUSY; |
212 | goto err2; | 212 | goto clear_companion; |
213 | } | 213 | } |
214 | hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len); | 214 | hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len); |
215 | if (hcd->regs == NULL) { | 215 | if (hcd->regs == NULL) { |
216 | dev_dbg(&dev->dev, "error mapping memory\n"); | 216 | dev_dbg(&dev->dev, "error mapping memory\n"); |
217 | retval = -EFAULT; | 217 | retval = -EFAULT; |
218 | goto err3; | 218 | goto release_mem_region; |
219 | } | 219 | } |
220 | 220 | ||
221 | } else { | 221 | } else { |
@@ -236,7 +236,7 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
236 | if (region == PCI_ROM_RESOURCE) { | 236 | if (region == PCI_ROM_RESOURCE) { |
237 | dev_dbg(&dev->dev, "no i/o regions available\n"); | 237 | dev_dbg(&dev->dev, "no i/o regions available\n"); |
238 | retval = -EBUSY; | 238 | retval = -EBUSY; |
239 | goto err2; | 239 | goto clear_companion; |
240 | } | 240 | } |
241 | } | 241 | } |
242 | 242 | ||
@@ -244,24 +244,24 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
244 | 244 | ||
245 | retval = usb_add_hcd(hcd, dev->irq, IRQF_DISABLED | IRQF_SHARED); | 245 | retval = usb_add_hcd(hcd, dev->irq, IRQF_DISABLED | IRQF_SHARED); |
246 | if (retval != 0) | 246 | if (retval != 0) |
247 | goto err4; | 247 | goto unmap_registers; |
248 | set_hs_companion(dev, hcd); | 248 | set_hs_companion(dev, hcd); |
249 | 249 | ||
250 | if (pci_dev_run_wake(dev)) | 250 | if (pci_dev_run_wake(dev)) |
251 | pm_runtime_put_noidle(&dev->dev); | 251 | pm_runtime_put_noidle(&dev->dev); |
252 | return retval; | 252 | return retval; |
253 | 253 | ||
254 | err4: | 254 | unmap_registers: |
255 | if (driver->flags & HCD_MEMORY) { | 255 | if (driver->flags & HCD_MEMORY) { |
256 | iounmap(hcd->regs); | 256 | iounmap(hcd->regs); |
257 | err3: | 257 | release_mem_region: |
258 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | 258 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); |
259 | } else | 259 | } else |
260 | release_region(hcd->rsrc_start, hcd->rsrc_len); | 260 | release_region(hcd->rsrc_start, hcd->rsrc_len); |
261 | err2: | 261 | clear_companion: |
262 | clear_hs_companion(dev, hcd); | 262 | clear_hs_companion(dev, hcd); |
263 | usb_put_hcd(hcd); | 263 | usb_put_hcd(hcd); |
264 | err1: | 264 | disable_pci: |
265 | pci_disable_device(dev); | 265 | pci_disable_device(dev); |
266 | dev_err(&dev->dev, "init %s fail, %d\n", pci_name(dev), retval); | 266 | dev_err(&dev->dev, "init %s fail, %d\n", pci_name(dev), retval); |
267 | return retval; | 267 | return retval; |