Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3874438pxb; Tue, 10 Nov 2020 02:13:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJw09kJXnLGXtOFQbuglDvPSY0b3DrLZniQDqtFyz+pFf4i4t4EXKyLYRlD6UhB9WgJEwRV2 X-Received: by 2002:a50:cc48:: with SMTP id n8mr20767368edi.137.1605003217883; Tue, 10 Nov 2020 02:13:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605003217; cv=none; d=google.com; s=arc-20160816; b=TiOsKDHOgp3QGLQe6QGUBIgF/GRgeAVgzEfVTBwC+1XaUEk+A57npFXnusS0CCtAnC og1nqahGJnRyRcjWttGjhuui4qmi0yFW5AeISnGmwupu8X8iOpp5XNievnBiMm2lEBej lqnPhIOgQMg7gSD8zkWy+gal9F4j4toXwiZkc81T7ackB0oTwXZPZdnhq7MU8kFhTqpK 1BtJ/8/c0XyFMSwW31aERIQQKbZnEVayIAOs57eD4lLx2xotNQbo4iZboFPkL2/TajUH mYGwtIQ8uxs4jOyiJ5kJ/MSvn/ysmUBKVDuZ9Fhgyr6SB6tlzr9avC8xu3ozU2bogu+j mZ/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=PV6g9753P//y05NqJPYlJlIU7oQW+paXbgXoF5MusfU=; b=hO4sHU1fO3duHGo+MA+Ov1Io12haNyofHThcZ7XPU89CduEVdaWERxTg2hRzqAKwzc wvElnbaZk10KSe6kAs7NvMwuFu++zMtuXgjvET2NDl9dHuKeopAZz2QebbprRGOP9UAG PUhkdQw6HXq6wQuOD9m0+OvqP5/Q44IC8zDas7Ga6bfbSRDLkgmZcF27T4esfLP/uEM1 cVezcuo12646Ou1ZI2PsE7VbZZ7HKPuVmNAeFn9b829L6CBuFMcfYgjwxSzJKB93w0bm eKy+RvW4cpu74WMXSCot/lZpq/3Oqqm8gZntUc/R3cQSmkrZSL1wE4Oscc5xqCcsP2HR CoDQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m20si3888690ejg.474.2020.11.10.02.13.14; Tue, 10 Nov 2020 02:13:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727325AbgKJKLN (ORCPT + 99 others); Tue, 10 Nov 2020 05:11:13 -0500 Received: from foss.arm.com ([217.140.110.172]:53232 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726462AbgKJKLM (ORCPT ); Tue, 10 Nov 2020 05:11:12 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8D9A611D4; Tue, 10 Nov 2020 02:11:11 -0800 (PST) Received: from e120937-lin (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D51443F6CF; Tue, 10 Nov 2020 02:11:10 -0800 (PST) Date: Tue, 10 Nov 2020 10:11:08 +0000 From: Cristian Marussi To: Qinglang Miao Cc: Sudeep Holla , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2] firmware: arm_scmi: fix missing destroy_workqueue() Message-ID: <20201110101108.GC30029@e120937-lin> References: <20201110074221.41235-1-miaoqinglang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201110074221.41235-1-miaoqinglang@huawei.com> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Signed-off-by: Qinglang Miao > --- > 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 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