staging: octeon-usb: call device_unregister when platform_device_register_simple...
authorDevendra Naga <devendra.aaru@gmail.com>
Mon, 3 Jun 2013 21:16:21 +0000 (02:46 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Jun 2013 22:25:42 +0000 (15:25 -0700)
device_register is called before platform_device_register_simple gets called.
unregister and reset the octeon_usb_registered variable

Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: David Daney <ddaney.cavm@gmail.com>
Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/octeon-usb/octeon-hcd.c

index f3a096be2abaa3db1c33bcbf8f518051d6f15ac4..fa72d59e3aa0a3e44bbaa77dc34aa42a525e2aba 100644 (file)
@@ -785,6 +785,8 @@ static int __init octeon_usb_module_init(void)
         pdev = platform_device_register_simple((char*)octeon_usb_driver.name, device, &irq_resource, 1);
         if (IS_ERR(pdev)) {
             DEBUG_FATAL("OcteonUSB: Failed to allocate platform device for USB%d\n", device);
+               driver_unregister(&octeon_usb_driver);
+               octeon_usb_registered = 0;
             return PTR_ERR(pdev);
         }
         if (device < MAX_USB_PORTS)