usb: u132-hcd: fix resource leak
authorMukesh Ojha <mojha@codeaurora.org>
Tue, 26 Mar 2019 08:12:22 +0000 (13:42 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Mar 2019 15:08:49 +0000 (00:08 +0900)
if platform_driver_register fails, cleanup the allocated resource
gracefully.

Signed-off-by: Mukesh Ojha <mojha@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/u132-hcd.c

index 934584f..6343fba 100644 (file)
@@ -3204,6 +3204,9 @@ static int __init u132_hcd_init(void)
        printk(KERN_INFO "driver %s\n", hcd_name);
        workqueue = create_singlethread_workqueue("u132");
        retval = platform_driver_register(&u132_platform_driver);
+       if (retval)
+               destroy_workqueue(workqueue);
+
        return retval;
 }