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.maru...@arm.com>
> Signed-off-by: Qinglang Miao <miaoqingl...@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.maru...@arm.com>

Thanks

Cristian

> -- 
> 2.23.0
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-ker...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Reply via email to