Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp339328pxb; Thu, 25 Feb 2021 04:07:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJzqFHOO739qTOasjfXOkLQVFfFPvSkCqoSO1yoXIlCmr37Ydg+fxPPVc6uoK7NuFXdAw8fC X-Received: by 2002:a17:906:5016:: with SMTP id s22mr2376905ejj.550.1614254838341; Thu, 25 Feb 2021 04:07:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614254838; cv=none; d=google.com; s=arc-20160816; b=D8lp5kOMXxcD59n3esTiBe1xQpUteSxcv7tsN4QXOrO9PQQIEOCH5brMQfzEAL9CbT aJCHkH5Og4iJdQuIjQb5ym5iMz3gjYj46hRqUw2kV+NZ0Anitf4OZOy+0jZ6p8pxVR91 oJxUdSMFciZRERxipVQkAWXikltUxCotvI6ZG3XVAFJfGgs1d/1LA89bFwALnMS50kUe AJ+ZAsD0IdEecIkbfRdqtGEE5odwRzTp6Iqk/8KT5tdfzYjHw5EpXceDuUvDu2CZBDIz aH0GcKLrZjEkzrKOG0T8C5ltivM/eXT6dSVp2r6ugywr+zFwTmwLYAdR44b89CrqBQRg GzWA== 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=gqndhnhO5gG0KqN9TXBEdWfsvD88ClKmce7iL72Wmh0=; b=EjA1Z1Mnb5+2GYcDTV8JUC6mZ/qzfKgwejxgWsrbpEzpF9B3pGxtVsEcWuhrcmQCzz 6l6Sc08xbhqJ4rxgj2asXfcIQPgEbydiiU6WzA+Rnwnmm7A1+ztZZrKtses904VF7gAE Y1KCAM9vOe2xC3fG4EXdW7q7tPM/zAva2bjd5guXVr6Ax96IEYyMKTfnzX1uvxpP/xJI Ci+AB0wFEoieMOUHWXSyHCTXwpUtoo2vCUPeU0yrCqLWzbj46GmIkAEVo5NeA3g/qW6J ZUfYVB9xB+h9g1fOKOpipi0ym3gBsy2RV4xeGnf3j5QPpRH88RMCiqoaACiqWj8kfdub ueRQ== 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 x21si3272160ejv.446.2021.02.25.04.06.55; Thu, 25 Feb 2021 04:07:18 -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 S233659AbhBYMFM (ORCPT + 99 others); Thu, 25 Feb 2021 07:05:12 -0500 Received: from foss.arm.com ([217.140.110.172]:56418 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229769AbhBYMFL (ORCPT ); Thu, 25 Feb 2021 07:05:11 -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 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 Cc: sudeep.holla@arm.com, lgirdwood@gmail.com, broonie@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org 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-Type: text/plain; charset=us-ascii 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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 >