[PATCH 6/6] staging: octeon-usb: call device_unregister when platform_device_register_simple fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



device_register is called before platform_device_register_simple gets called.
unregister and reset the octeon_usb_registered variable

Cc: Aaro Koskinen <aaro.koskinen@xxxxxx>
Cc: David Daney <ddaney.cavm@xxxxxxxxx>
Signed-off-by: Devendra Naga <devendra.aaru@xxxxxxxxx>
---
 drivers/staging/octeon-usb/octeon-hcd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c
index f3a096b..fa72d59 100644
--- a/drivers/staging/octeon-usb/octeon-hcd.c
+++ b/drivers/staging/octeon-usb/octeon-hcd.c
@@ -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)
-- 
1.8.2.1

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux