aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2007-01-15 20:12:06 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2007-02-07 15:44:37 -0800
commitde44743b033942731f6b898c2d389f7ee5ac890b (patch)
treea7ad370d255443948e23571b0ad658dbbc1e2c13
parent4a1a4d8b87389e35c3af04c0d0a95f6a0391b964 (diff)
USB: ohci error handling cleanup
Restructure the ohci_hcd_mod_init error handling code in to better support the multiple platform drivers. This does not change the functionality. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/host/ohci-hcd.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 8baecbdf062..2c4a6299e4c 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -929,7 +929,6 @@ MODULE_LICENSE ("GPL");
static int __init ohci_hcd_mod_init(void)
{
int retval = 0;
- int ls = 0;
if (usb_disabled())
return -ENODEV;
@@ -941,46 +940,44 @@ static int __init ohci_hcd_mod_init(void)
#ifdef PLATFORM_DRIVER
retval = platform_driver_register(&PLATFORM_DRIVER);
if (retval < 0)
- return retval;
- ls++;
+ goto error_platform;
#endif
#ifdef OF_PLATFORM_DRIVER
retval = of_register_platform_driver(&OF_PLATFORM_DRIVER);
if (retval < 0)
- goto error;
- ls++;
+ goto error_of_platform;
#endif
#ifdef SA1111_DRIVER
retval = sa1111_driver_register(&SA1111_DRIVER);
if (retval < 0)
- goto error;
- ls++;
+ goto error_sa1111;
#endif
#ifdef PCI_DRIVER
retval = pci_register_driver(&PCI_DRIVER);
if (retval < 0)
- goto error;
- ls++;
+ goto error_pci;
#endif
return retval;
/* Error path */
-error:
-#ifdef PLATFORM_DRIVER
- if (ls--)
- platform_driver_unregister(&PLATFORM_DRIVER);
+#ifdef PCI_DRIVER
+ error_pci:
+#endif
+#ifdef SA1111_DRIVER
+ sa1111_driver_unregister(&SA1111_DRIVER);
+ error_sa1111:
#endif
#ifdef OF_PLATFORM_DRIVER
- if (ls--)
- of_unregister_platform_driver(&OF_PLATFORM_DRIVER);
+ of_unregister_platform_driver(&OF_PLATFORM_DRIVER);
+ error_of_platform:
#endif
-#ifdef SA1111_DRIVER
- if (ls--)
- sa1111_driver_unregister(&SA1111_DRIVER);
+#ifdef PLATFORM_DRIVER
+ platform_driver_unregister(&PLATFORM_DRIVER);
+ error_platform:
#endif
return retval;
}