From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 589D8C433DB for ; Thu, 25 Feb 2021 12:05:59 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E9F8764F11 for ; Thu, 25 Feb 2021 12:05:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E9F8764F11 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Owkqp/FF4SAEmiuXV8hCxiw/jO2sCfI/qiDD4+R8c8A=; b=LV7pdYw5bU3K/d5jRsZ+Xmz69 VlrwPQn+jPmS2MnpSh9W5ptKzKQ7NG58alPGRP8ii8KZ3DmieLI8OtS09RYjSe9ZduT/qEjSdx1K1 PG6noGOxhh8+1EVkRQrhPdJSRFO/wUfehKh0jeCb60t23ZMpaFs8eoVceHjESGMof6MMH0q81EpVL IE6TwV52BLmThfwTiptbG4DFrOm7sMyBBmBPSH1CZ54GBq4TGaMV3U6GP3eHdLG2X2FW6fMMySEU6 DAkeM27c8NtPUfuxIXt7DqNhcVi7ATI1KM06PmsbFu4zm4xpJRDa5WRP0Q9bMjjxkEwlu0owJxy55 MSilHcd1w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFFNe-00044K-9P; Thu, 25 Feb 2021 12:04:30 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFFNc-00043u-0V for linux-arm-kernel@lists.infradead.org; Thu, 25 Feb 2021 12:04:28 +0000 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 DAE91D6E; Thu, 25 Feb 2021 04:04:25 -0800 (PST) Received: from e120937-lin (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8E3493F73D; Thu, 25 Feb 2021 04:04:24 -0800 (PST) Date: Thu, 25 Feb 2021 12:04:14 +0000 From: Cristian Marussi To: Yang Li Subject: Re: [PATCH] regulator: add missing call to of_node_put() Message-ID: <20210225120414.GD29356@e120937-lin> References: <1614244046-57560-1-git-send-email-yang.lee@linux.alibaba.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1614244046-57560-1-git-send-email-yang.lee@linux.alibaba.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210225_070428_138109_3C5C2ABE X-CRM114-Status: GOOD ( 19.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, broonie@kernel.org, lgirdwood@gmail.com, linux-arm-kernel@lists.infradead.org, sudeep.holla@arm.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, thanks for reporting this, you're right but you've missed the braces around the if block in your patch, because we really want to exit only on -ENOMEM. Something like: if (ret == -ENOMEM) { of_node_put(child); return ret; } Regards, Cristian On Thu, Feb 25, 2021 at 05:07:26PM +0800, Yang Li wrote: > In one of the error paths of the for_each_child_of_node() loop, > add missing call to of_node_put(). > > Fix the following coccicheck warning: > ./drivers/regulator/scmi-regulator.c:343:1-23: WARNING: Function > "for_each_child_of_node" should have of_node_put() before return around > line 347. > > Reported-by: Abaci Robot > Signed-off-by: Yang Li > --- > drivers/regulator/scmi-regulator.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/regulator/scmi-regulator.c b/drivers/regulator/scmi-regulator.c > index 0e8b3ca..a41bb06 100644 > --- a/drivers/regulator/scmi-regulator.c > +++ b/drivers/regulator/scmi-regulator.c > @@ -344,6 +344,7 @@ static int scmi_regulator_probe(struct scmi_device *sdev) > ret = process_scmi_regulator_of_node(sdev, child, rinfo); > /* abort on any mem issue */ > if (ret == -ENOMEM) > + of_node_put(child); > return ret; > } > > -- > 1.8.3.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel