linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] firmware: arm_scmi: fix missing destroy_workqueue()
@ 2020-11-10  7:42 Qinglang Miao
  2020-11-10 10:11 ` Cristian Marussi
  2020-11-13 14:19 ` Sudeep Holla
  0 siblings, 2 replies; 3+ messages in thread
From: Qinglang Miao @ 2020-11-10  7:42 UTC (permalink / raw)
  To: Sudeep Holla; +Cc: linux-arm-kernel, linux-kernel, Qinglang Miao

destroy_workqueue seems necessary before return from
scmi_notification_init in the error handling case when
fails to do devm_kcalloc(). Fix this by simply moving
devm_kcalloc to the front.

Fixes: bd31b249692e ("firmware: arm_scmi: Add notification dispatch and delivery")
Suggested-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
---
 v2: fix this problem by simply moving codes.

 drivers/firmware/arm_scmi/notify.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/firmware/arm_scmi/notify.c b/drivers/firmware/arm_scmi/notify.c
index 2754f9d01636..fdb2cc95dfde 100644
--- a/drivers/firmware/arm_scmi/notify.c
+++ b/drivers/firmware/arm_scmi/notify.c
@@ -1468,17 +1468,17 @@ int scmi_notification_init(struct scmi_handle *handle)
 	ni->gid = gid;
 	ni->handle = handle;
 
+	ni->registered_protocols = devm_kcalloc(handle->dev, SCMI_MAX_PROTO,
+						sizeof(char *), GFP_KERNEL);
+	if (!ni->registered_protocols)
+		goto err;
+
 	ni->notify_wq = alloc_workqueue("scmi_notify",
 					WQ_UNBOUND | WQ_FREEZABLE | WQ_SYSFS,
 					0);
 	if (!ni->notify_wq)
 		goto err;
 
-	ni->registered_protocols = devm_kcalloc(handle->dev, SCMI_MAX_PROTO,
-						sizeof(char *), GFP_KERNEL);
-	if (!ni->registered_protocols)
-		goto err;
-
 	mutex_init(&ni->pending_mtx);
 	hash_init(ni->pending_events_handlers);
 
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-13 14:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10  7:42 [PATCH v2] firmware: arm_scmi: fix missing destroy_workqueue() Qinglang Miao
2020-11-10 10:11 ` Cristian Marussi
2020-11-13 14:19 ` Sudeep Holla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).