linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Cristian Marussi <cristian.marussi@arm.com>
To: Qinglang Miao <miaoqinglang@huawei.com>
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Sudeep Holla <sudeep.holla@arm.com>
Subject: Re: [PATCH v2] firmware: arm_scmi: fix missing destroy_workqueue()
Date: Tue, 10 Nov 2020 10:11:08 +0000	[thread overview]
Message-ID: <20201110101108.GC30029@e120937-lin> (raw)
In-Reply-To: <20201110074221.41235-1-miaoqinglang@huawei.com>

Hi

On Tue, Nov 10, 2020 at 03:42:21PM +0800, Qinglang Miao wrote:
> 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);
>  

Looks good to me.

Just be aware that it seems you're patch is not based on top of
sudeep/for-next/scmi at:

b9ceca6be432 firmware: arm_scmi: Fix duplicate workqueue name

whose top commit indeed changes the workqueue naming style:

1fc2dd1864c2b (Cristian Marussi 2020-07-01 16:53:40 +0100 1476)
b9ceca6be4323 (Florian Fainelli 2020-10-13 19:17:37 -0700 1477)         ni->notify_wq = alloc_workqueue(dev_name(handle->dev),
bd31b249692e2 (Cristian Marussi 2020-07-01 16:53:42 +0100 1478)                                         WQ_UNBOUND | WQ_FREEZABLE | WQ_SYSFS,
bd31b249692e2 (Cristian Marussi 2020-07-01 16:53:42 +0100 1479)                                         0);
bd31b249692e2 (Cristian Marussi 2020-07-01 16:53:42 +0100 1480)         if (!ni->notify_wq)
bd31b249692e2 (Cristian Marussi 2020-07-01 16:53:42 +0100 1481)                 goto err;
bd31b249692e2 (Cristian Marussi 2020-07-01 16:53:42 +0100 1482)

So I'm a bit worried it could fail to apply cleanly as it is, it would
be better if possible to rebase it on top of for-next/scmi.

Beside this

Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>

Thanks

Cristian

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

  reply	other threads:[~2020-11-10 10:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-10  7:42 [PATCH v2] firmware: arm_scmi: fix missing destroy_workqueue() Qinglang Miao
2020-11-10 10:11 ` Cristian Marussi [this message]
2020-11-13 14:19 ` Sudeep Holla

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=20201110101108.GC30029@e120937-lin \
    --to=cristian.marussi@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miaoqinglang@huawei.com \
    --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;
as well as URLs for NNTP newsgroup(s).