Skip to contentSkip to conversation

svc: add missed destroy_workqueue when gb_svc_create fails

PATCH In review Li Heng 2 participants 2 messages Jul 25, 2020 Greybus

lore
Share & tools
lore

Li Heng

author
#0 lore raw

PATCH 1/1 svc: add missed destroy_workqueue when gb_svc_create fails

destroy_workqueue() should be called to destroy svc->wq when gb_svc_create() init resources fails.

Fixes 8465def499c7 ("staging: greybus: move the greybus core to drivers/greybus")
---
 drivers/greybus/svc.c | 1 +
 1 file changed, 1 insertion(+)
drivers/greybus/svc.c +1 -0
index ce7740e..38f858f 100644
@@ -1340,6 +1340,7 @@ struct gb_svc *gb_svc_create(struct gb_host_device *hd)
 
 err_put_device:
 	put_device(&svc->dev);
+	destroy_workqueue(svc->wq);
 	return NULL;
 }
 
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 15 lines · Li Heng

destroy_workqueue() should be called to destroy svc->wq when gb_svc_create() init resources fails.

Fixes 8465def499c7 ("staging: greybus: move the greybus core to drivers/greybus")
---
 drivers/greybus/svc.c | 1 +
 1 file changed, 1 insertion(+)
drivers/greybus/svc.c +0 -0
index ce7740e..38f858f 100644

drivers/greybus/svc.c struct gb_svc *gb_svc_create(struct gb_host_device *hd) · line 1343

Quoted 4 lines
drivers/greybus/svc.c +1 -0
@@ -1340,6 +1340,7 @@ struct gb_svc *gb_svc_create(struct gb_host_device *hd)
 
 err_put_device:
 	put_device(&svc->dev);
+	destroy_workqueue(svc->wq);

Your bot is broken; the workqueue is released in gb_svc_release().

And please fix your internal review process so that you catch things like this before posting.

drivers/greybus/svc.c struct gb_svc *gb_svc_create(struct gb_host_device *hd) · line 1345

Quoted 2 lines
drivers/greybus/svc.c +0 -0
 	return NULL;
 }

Johan