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>
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)