Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1731426pxb; Thu, 28 Oct 2021 09:03:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQs6YslKDFwgDwoAkj42ZLhdPFSmEHl+0vxDK8FcBAvQDi1oFW0w48JNh+YmXwAymZvbA7 X-Received: by 2002:a17:902:7101:b0:140:3e2c:1cbe with SMTP id a1-20020a170902710100b001403e2c1cbemr4565426pll.83.1635436987510; Thu, 28 Oct 2021 09:03:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635436987; cv=none; d=google.com; s=arc-20160816; b=EIE+aKtGshbIeECpUe/FCtLwgC3d79rYm62hRtLAmGx4yfNgvj3oXjOtKFhXLD4aLQ 6pYbfILk87QEEB6aLDtYVDpS5VuoxSjVCCnKqOSf3E18Ahbi2fXcL2eYdC6KpcDutrkd qROTWENhtA48oqS0AV0CQyXYZAGFloc/sVz4gW8bK8HxGuml4inHQT4EXPm9jP0slTO2 FTpHykJKXT7GuVEha5zacM3EDzwz5MRm2TMpWiFTcHY9gAO7HJNdB4FEbopWSP4g8bhu f9hzvwV89ohq9dNpCkNIuqeBb3g2GJdu+TzvNY5VlsJ0FfIOnDthJIdxFpGGWRN8uPAw 3cLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=cqC1Iz3u9L3lRHYBQuY+FHDwQEwTiJO5iCfMASD2a9o=; b=hdb77qtJGYB8C8HP5ENTG0+UoPnNcf5GjVq3Vo5YP6Z9xI2MLZq1A2vgoGiBLCUren 17vWDR9jT+SUi1ZLaTMpeqVB/NO0jVBosPCmUbQadxSXvkU4ZEfC5o+sEfYqFU2/q/ev 39Nr0Q2WNXHuY8SlGgxAGLnzBzLMTJKpjG/t/f8jV/MTnZ9keuv1Z7mFoUK7UxSYBAIB wXjRCEBdZ4H3SoEMRS9tGkECyLEFfTdy7/iYmGI+YWEt1XPK4NMzvlN1AquCob2BBxnD G+nje34qf1lz6YD0GICd1PcfKIAY/++oCgcUwPmS3gcTpjHCuFvWKoY1LieJXT6N0TpQ P6QQ== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j25si3909210pfr.374.2021.10.28.09.02.52; Thu, 28 Oct 2021 09:03:07 -0700 (PDT) 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230225AbhJ1QCF (ORCPT + 99 others); Thu, 28 Oct 2021 12:02:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:45000 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230046AbhJ1QCE (ORCPT ); Thu, 28 Oct 2021 12:02:04 -0400 Received: from jic23-huawei (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CD6F460FC4; Thu, 28 Oct 2021 15:59:33 +0000 (UTC) Date: Thu, 28 Oct 2021 17:04:00 +0100 From: Jonathan Cameron To: Wan Jiabing Cc: Lars-Peter Clausen , Maxime Coquelin , Alexandre Torgue , Fabrice Gasnier , Olivier Moysan , Mauro Carvalho Chehab , Ahmad Fatoum , Xu Wang , linux-iio@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, jiabing.wan@qq.com Subject: Re: [PATCH v3] iio: adc: stm32-adc: Fix of_node_put() issue in stm32-adc Message-ID: <20211028170400.1d922d5c@jic23-huawei> In-Reply-To: <20211028154204.1263861-1-wanjiabing@vivo.com> References: <20211028154204.1263861-1-wanjiabing@vivo.com> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 28 Oct 2021 23:42:02 +0800 Wan Jiabing wrote: > Fix following coccicheck warning: > ./drivers/iio/adc/stm32-adc.c:2014:1-33: WARNING: Function > for_each_available_child_of_node should have of_node_put() before return. > > Early exits from for_each_available_child_of_node should decrement the > node reference counter. Replace return by goto here. > > Reviewed-by: Fabrice Gasnier > Signed-off-by: Wan Jiabing I applied v2. So no need to resend. I fix minor typos etc whilst applying patches as it saves everyone time! Thanks, Jonathan > --- > Changelog: > v2: > - Fix typo and add reviewed-by. > v3: > - Fix typo. > --- > drivers/iio/adc/stm32-adc.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c > index 6245434f8377..7f1fb36c747c 100644 > --- a/drivers/iio/adc/stm32-adc.c > +++ b/drivers/iio/adc/stm32-adc.c > @@ -2024,7 +2024,8 @@ static int stm32_adc_generic_chan_init(struct iio_dev *indio_dev, > if (strlen(name) >= STM32_ADC_CH_SZ) { > dev_err(&indio_dev->dev, "Label %s exceeds %d characters\n", > name, STM32_ADC_CH_SZ); > - return -EINVAL; > + ret = -EINVAL; > + goto err; > } > strncpy(adc->chan_name[val], name, STM32_ADC_CH_SZ); > ret = stm32_adc_populate_int_ch(indio_dev, name, val);