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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 626F5C433FE for ; Thu, 28 Oct 2021 14:22:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4E006610FC for ; Thu, 28 Oct 2021 14:22:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231210AbhJ1OYh (ORCPT ); Thu, 28 Oct 2021 10:24:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:52416 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230265AbhJ1OYf (ORCPT ); Thu, 28 Oct 2021 10:24:35 -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 E5F8D61073; Thu, 28 Oct 2021 14:22:04 +0000 (UTC) Date: Thu, 28 Oct 2021 15:26:31 +0100 From: Jonathan Cameron To: Wan Jiabing Cc: Lars-Peter Clausen , Maxime Coquelin , Alexandre Torgue , Fabrice Gasnier , Olivier Moysan , Mauro Carvalho Chehab , Xu Wang , Ahmad Fatoum , linux-iio@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kael_w@yeah.net Subject: Re: [PATCH v2] iio: adc: stm32-adc: Fix of_node_put() issue in stm32-adc Message-ID: <20211028152631.0aa9c619@jic23-huawei> In-Reply-To: <20211021121826.6339-1-wanjiabing@vivo.com> References: <20211021121826.6339-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, 21 Oct 2021 08:18:23 -0400 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. Repalce return by goto here. Replace > > Reviewed-by: Fabrice Gasnier > Signed-off-by: Wan Jiabing We could treat this as a fix, but I'm feeling lazy and it's a minor that should be harmless. So applied to the togreg branch of iio.git and pushed out as testing for 0-day to see if it can find anything we missed. Thanks, Jonathan > --- > Changelog: > v2: > - Fix typo and add reviewed-by. > --- > 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); 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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16741C433F5 for ; Thu, 28 Oct 2021 14:28:49 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 DBEFD60F70 for ; Thu, 28 Oct 2021 14:28:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DBEFD60F70 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:Cc: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=zh1FcxxvC0Fg7ttmSlTF5z5mEJrrqIhlEjUu/pP5ZKo=; b=zA26o3kjUxRwH6 BzXKel7LK6qupI7cHYCKa6+B+ri6v9hedvVmjDXlrSYNmuxqOEhCThx1WuPR/9sNta5Ip/6RoKnIT ChUMZ5sHun8pB2E1CAcmqAbzHu0AxBQ2DBRcdIN58ejxniRGIjTk0HLnnP3mrW8BKLhNf6DJ0obHg Y5jrUEDFlj7zdG5HM6wrvi39a6Qo6UD180+8t/ucxjbcvfhRiBx57z/5GPiTQefujG5h7JGXMCgid /L1XLprgiQipnC0dEGJLRjeO52OtUQSvY1k8C7R0OkW6RX0gC11Y4zzMKcXmcpJzfV4udnxzV/lzw BVofE2MOEnMh5kBu3H9A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mg6Mx-0089Ga-JQ; Thu, 28 Oct 2021 14:27:03 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mg6ID-00878l-5m for linux-arm-kernel@lists.infradead.org; Thu, 28 Oct 2021 14:22:10 +0000 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 E5F8D61073; Thu, 28 Oct 2021 14:22:04 +0000 (UTC) Date: Thu, 28 Oct 2021 15:26:31 +0100 From: Jonathan Cameron To: Wan Jiabing Cc: Lars-Peter Clausen , Maxime Coquelin , Alexandre Torgue , Fabrice Gasnier , Olivier Moysan , Mauro Carvalho Chehab , Xu Wang , Ahmad Fatoum , linux-iio@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kael_w@yeah.net Subject: Re: [PATCH v2] iio: adc: stm32-adc: Fix of_node_put() issue in stm32-adc Message-ID: <20211028152631.0aa9c619@jic23-huawei> In-Reply-To: <20211021121826.6339-1-wanjiabing@vivo.com> References: <20211021121826.6339-1-wanjiabing@vivo.com> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211028_072209_291951_C8D46502 X-CRM114-Status: GOOD ( 19.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 On Thu, 21 Oct 2021 08:18:23 -0400 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. Repalce return by goto here. Replace > > Reviewed-by: Fabrice Gasnier > Signed-off-by: Wan Jiabing We could treat this as a fix, but I'm feeling lazy and it's a minor that should be harmless. So applied to the togreg branch of iio.git and pushed out as testing for 0-day to see if it can find anything we missed. Thanks, Jonathan > --- > Changelog: > v2: > - Fix typo and add reviewed-by. > --- > 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); _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel