usb: u132-hcd: fix resource leak
diff mbox series

Message ID 1553587942-14037-1-git-send-email-mojha@codeaurora.org
State Accepted
Commit f276e002793cdb820862e8ea8f76769d56bba575
Headers show
Series
  • usb: u132-hcd: fix resource leak
Related show

Commit Message

Mukesh Ojha March 26, 2019, 8:12 a.m. UTC
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(+)

Patch
diff mbox series

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;
 }