[PATCH 38/70] USB: ohci error handling cleanup

Greg KH <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
From: Benjamin Herrenschmidt <[email protected]>

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 <[email protected]>
Cc: David Brownell <[email protected]>
Signed-off-by: Geoff Levand <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
 drivers/usb/host/ohci-hcd.c |   33 +++++++++++++++------------------
 1 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 8baecbd..2c4a629 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;
 }
-- 
1.4.4.4


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.