Commit 5e15430e authored by Devendra Naga's avatar Devendra Naga Committed by Greg Kroah-Hartman

staging: octeon-usb: call device_unregister when platform_device_register_simple fails

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: default avatarDevendra Naga <devendra.aaru@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 55fa328a
...@@ -785,6 +785,8 @@ static int __init octeon_usb_module_init(void) ...@@ -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); pdev = platform_device_register_simple((char*)octeon_usb_driver.name, device, &irq_resource, 1);
if (IS_ERR(pdev)) { if (IS_ERR(pdev)) {
DEBUG_FATAL("OcteonUSB: Failed to allocate platform device for USB%d\n", device); 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); return PTR_ERR(pdev);
} }
if (device < MAX_USB_PORTS) if (device < MAX_USB_PORTS)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment