Messages in this thread Patch in this message | | | From | Mukesh Ojha <> | Subject | [PATCH] usb: u132-hcd: fix resource leak | Date | Tue, 26 Mar 2019 13:42:22 +0530 |
| |
if platform_driver_register fails, cleanup the allocated resource gracefully.
Signed-off-by: Mukesh Ojha <mojha@codeaurora.org> --- This patch is dependent on "usb: u132-hcd: fix potential NULL pointer dereference" by Kangjie Lu, otherwise it may give merge conflict.
drivers/usb/host/u132-hcd.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c index 934584f..1d8d578 100644 --- a/drivers/usb/host/u132-hcd.c +++ b/drivers/usb/host/u132-hcd.c @@ -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; } -- Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
| |