diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2007-01-15 23:12:06 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-02-07 18:44:37 -0500 |
commit | de44743b033942731f6b898c2d389f7ee5ac890b (patch) | |
tree | a7ad370d255443948e23571b0ad658dbbc1e2c13 /drivers/usb/host/ohci-hcd.c | |
parent | 4a1a4d8b87389e35c3af04c0d0a95f6a0391b964 (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>
Diffstat (limited to 'drivers/usb/host/ohci-hcd.c')
-rw-r--r-- | 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 8baecbdf0621..2c4a6299e4c6 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -929,7 +929,6 @@ MODULE_LICENSE ("GPL"); | |||
929 | static int __init ohci_hcd_mod_init(void) | 929 | static int __init ohci_hcd_mod_init(void) |
930 | { | 930 | { |
931 | int retval = 0; | 931 | int retval = 0; |
932 | int ls = 0; | ||
933 | 932 | ||
934 | if (usb_disabled()) | 933 | if (usb_disabled()) |
935 | return -ENODEV; | 934 | return -ENODEV; |
@@ -941,46 +940,44 @@ static int __init ohci_hcd_mod_init(void) | |||
941 | #ifdef PLATFORM_DRIVER | 940 | #ifdef PLATFORM_DRIVER |
942 | retval = platform_driver_register(&PLATFORM_DRIVER); | 941 | retval = platform_driver_register(&PLATFORM_DRIVER); |
943 | if (retval < 0) | 942 | if (retval < 0) |
944 | return retval; | 943 | goto error_platform; |
945 | ls++; | ||
946 | #endif | 944 | #endif |
947 | 945 | ||
948 | #ifdef OF_PLATFORM_DRIVER | 946 | #ifdef OF_PLATFORM_DRIVER |
949 | retval = of_register_platform_driver(&OF_PLATFORM_DRIVER); | 947 | retval = of_register_platform_driver(&OF_PLATFORM_DRIVER); |
950 | if (retval < 0) | 948 | if (retval < 0) |
951 | goto error; | 949 | goto error_of_platform; |
952 | ls++; | ||
953 | #endif | 950 | #endif |
954 | 951 | ||
955 | #ifdef SA1111_DRIVER | 952 | #ifdef SA1111_DRIVER |
956 | retval = sa1111_driver_register(&SA1111_DRIVER); | 953 | retval = sa1111_driver_register(&SA1111_DRIVER); |
957 | if (retval < 0) | 954 | if (retval < 0) |
958 | goto error; | 955 | goto error_sa1111; |
959 | ls++; | ||
960 | #endif | 956 | #endif |
961 | 957 | ||
962 | #ifdef PCI_DRIVER | 958 | #ifdef PCI_DRIVER |
963 | retval = pci_register_driver(&PCI_DRIVER); | 959 | retval = pci_register_driver(&PCI_DRIVER); |
964 | if (retval < 0) | 960 | if (retval < 0) |
965 | goto error; | 961 | goto error_pci; |
966 | ls++; | ||
967 | #endif | 962 | #endif |
968 | 963 | ||
969 | return retval; | 964 | return retval; |
970 | 965 | ||
971 | /* Error path */ | 966 | /* Error path */ |
972 | error: | 967 | #ifdef PCI_DRIVER |
973 | #ifdef PLATFORM_DRIVER | 968 | error_pci: |
974 | if (ls--) | 969 | #endif |
975 | platform_driver_unregister(&PLATFORM_DRIVER); | 970 | #ifdef SA1111_DRIVER |
971 | sa1111_driver_unregister(&SA1111_DRIVER); | ||
972 | error_sa1111: | ||
976 | #endif | 973 | #endif |
977 | #ifdef OF_PLATFORM_DRIVER | 974 | #ifdef OF_PLATFORM_DRIVER |
978 | if (ls--) | 975 | of_unregister_platform_driver(&OF_PLATFORM_DRIVER); |
979 | of_unregister_platform_driver(&OF_PLATFORM_DRIVER); | 976 | error_of_platform: |
980 | #endif | 977 | #endif |
981 | #ifdef SA1111_DRIVER | 978 | #ifdef PLATFORM_DRIVER |
982 | if (ls--) | 979 | platform_driver_unregister(&PLATFORM_DRIVER); |
983 | sa1111_driver_unregister(&SA1111_DRIVER); | 980 | error_platform: |
984 | #endif | 981 | #endif |
985 | return retval; | 982 | return retval; |
986 | } | 983 | } |