From: Qinglang Miao <miaoqinglang@huawei.com>
To: Cristian Marussi <cristian.marussi@arm.com>
Cc: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Sudeep Holla <sudeep.holla@arm.com>
Subject: Re: [PATCH] firmware: arm_scmi: fix missing destroy_workqueue() on error in scmi_notification_init
Date: Tue, 10 Nov 2020 09:23:14 +0800 [thread overview]
Message-ID: <661de7b2-b910-0e4f-42a4-8a0238d99fc8@huawei.com> (raw)
In-Reply-To: <20201109175136.GB42652@e120937-lin>
在 2020/11/10 1:51, Cristian Marussi 写道:
> On Mon, Nov 09, 2020 at 05:15:17PM +0800, Qinglang Miao wrote:
>> Add the missing destroy_workqueue() before return from
>> scmi_notification_init in the error handling case when
>> fails to do devm_kcalloc().
>>
>> Fixes: bd31b249692e ("firmware: arm_scmi: Add notification dispatch and delivery")
>> Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
>> ---
>> drivers/firmware/arm_scmi/notify.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/firmware/arm_scmi/notify.c b/drivers/firmware/arm_scmi/notify.c
>> index 2754f9d01636..3048e57d9731 100644
>> --- a/drivers/firmware/arm_scmi/notify.c
>> +++ b/drivers/firmware/arm_scmi/notify.c
>> @@ -1476,8 +1476,10 @@ int scmi_notification_init(struct scmi_handle *handle)
>>
>> ni->registered_protocols = devm_kcalloc(handle->dev, SCMI_MAX_PROTO,
>> sizeof(char *), GFP_KERNEL);
>> - if (!ni->registered_protocols)
>> + if (!ni->registered_protocols) {
>> + destroy_workqueue(ni->notify_wq);
>> goto err;
>> + }
>>
>
> Good catch, looks good to me.
>
> Even better you could move the above alloc_workqueue() block down here
> so that you can avoid all together the additional destroy_workqueue() on
> the above error path.
>
> Thanks
>
> Cristian
It sounds convincible to me Cristian, thanks for your advice ;D
I will send a v2 patch on this one in no time.
>
>
>> mutex_init(&ni->pending_mtx);
>> hash_init(ni->pending_events_handlers);
>> --
>> 2.23.0
>>
>>
>> _______________________________________________
>> linux-arm-kernel mailing list
>> linux-arm-kernel@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> .
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2020-11-10 1:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-09 9:15 [PATCH] firmware: arm_scmi: fix missing destroy_workqueue() on error in scmi_notification_init Qinglang Miao
2020-11-09 17:51 ` Cristian Marussi
2020-11-10 1:23 ` Qinglang Miao [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=661de7b2-b910-0e4f-42a4-8a0238d99fc8@huawei.com \
--to=miaoqinglang@huawei.com \
--cc=cristian.marussi@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sudeep.holla@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox