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>
This commit is contained in:
parent
4a1a4d8b87
commit
de44743b03
1 changed files with 16 additions and 19 deletions
|
@ -929,7 +929,6 @@ MODULE_LICENSE ("GPL");
|
||||||
static int __init ohci_hcd_mod_init(void)
|
static int __init ohci_hcd_mod_init(void)
|
||||||
{
|
{
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
int ls = 0;
|
|
||||||
|
|
||||||
if (usb_disabled())
|
if (usb_disabled())
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
@ -941,46 +940,44 @@ static int __init ohci_hcd_mod_init(void)
|
||||||
#ifdef PLATFORM_DRIVER
|
#ifdef PLATFORM_DRIVER
|
||||||
retval = platform_driver_register(&PLATFORM_DRIVER);
|
retval = platform_driver_register(&PLATFORM_DRIVER);
|
||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
return retval;
|
goto error_platform;
|
||||||
ls++;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef OF_PLATFORM_DRIVER
|
#ifdef OF_PLATFORM_DRIVER
|
||||||
retval = of_register_platform_driver(&OF_PLATFORM_DRIVER);
|
retval = of_register_platform_driver(&OF_PLATFORM_DRIVER);
|
||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
goto error;
|
goto error_of_platform;
|
||||||
ls++;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SA1111_DRIVER
|
#ifdef SA1111_DRIVER
|
||||||
retval = sa1111_driver_register(&SA1111_DRIVER);
|
retval = sa1111_driver_register(&SA1111_DRIVER);
|
||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
goto error;
|
goto error_sa1111;
|
||||||
ls++;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PCI_DRIVER
|
#ifdef PCI_DRIVER
|
||||||
retval = pci_register_driver(&PCI_DRIVER);
|
retval = pci_register_driver(&PCI_DRIVER);
|
||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
goto error;
|
goto error_pci;
|
||||||
ls++;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
/* Error path */
|
/* Error path */
|
||||||
error:
|
#ifdef PCI_DRIVER
|
||||||
#ifdef PLATFORM_DRIVER
|
error_pci:
|
||||||
if (ls--)
|
|
||||||
platform_driver_unregister(&PLATFORM_DRIVER);
|
|
||||||
#endif
|
|
||||||
#ifdef OF_PLATFORM_DRIVER
|
|
||||||
if (ls--)
|
|
||||||
of_unregister_platform_driver(&OF_PLATFORM_DRIVER);
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef SA1111_DRIVER
|
#ifdef SA1111_DRIVER
|
||||||
if (ls--)
|
sa1111_driver_unregister(&SA1111_DRIVER);
|
||||||
sa1111_driver_unregister(&SA1111_DRIVER);
|
error_sa1111:
|
||||||
|
#endif
|
||||||
|
#ifdef OF_PLATFORM_DRIVER
|
||||||
|
of_unregister_platform_driver(&OF_PLATFORM_DRIVER);
|
||||||
|
error_of_platform:
|
||||||
|
#endif
|
||||||
|
#ifdef PLATFORM_DRIVER
|
||||||
|
platform_driver_unregister(&PLATFORM_DRIVER);
|
||||||
|
error_platform:
|
||||||
#endif
|
#endif
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue