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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 43E06C77B76 for ; Sun, 23 Apr 2023 10:36:14 +0000 (UTC) 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=4wpmxG8Jl9cXd1Wvpqeo9DQJTHF2F8G9GHuhZzwVvmA=; b=UMd2RBcas4xmJ/ Oyap6c3JpWnOs4sFrFG2HggBvKxB/Ij7s22zfRAaI2FSiTuaVQaCVsMQMyUJ33/zxzilxzUjuPasT VBZURD4Gw1uoje3DTUM1yVqiyVS6NegzIYaomCZ6I0EHnXCMaaemaR00ZYnb4M2sKdTxp4WBjixGx e5ApGkglSk/8DPQX9CCreQjJQeA6IDqHp5Vq1Dr70ZYv2HhUg01sdo8hw5VQlOmxHX+3SD78mLuir XxHisCw26A3WOoyMC3zXo+Sp0cbkw8HJMVF+HjHLCdUr56VsMGnbP4MbfO+e8cOX/SnPzVTlNSXag fB/ELc5OlocMR2ckzUpw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pqX3u-00E9hj-0X; Sun, 23 Apr 2023 10:35:18 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pqX3r-00E9hQ-1r for linux-arm-kernel@lists.infradead.org; Sun, 23 Apr 2023 10:35:16 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1A7DE60BA1; Sun, 23 Apr 2023 10:35:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 004EFC433D2; Sun, 23 Apr 2023 10:35:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1682246114; bh=/t2IHSC/v+053Pgf7JS+Fm0t1B1+XJZH42S5TetJxk4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=aEv+vF3LLleJJP9IwbJK6UCwbGMm/EbstqE67Xs9MNhegUpT9ftAZ6APYLFskY8X3 1wDhfB8+9001+TSiRNMlcKTE3hBNBshgnoATkqEIUJmeEoqRBAzPsAygQafyN+1gM6 Pur/d214Upa9AEMebPhgvuRrPhNxHCXYbpnB7ODNmrEtdOtGcA5XQpVqYO0cz3hUeX 6+mKRIejfAlKmfVXA3IM+xfnqXYNP0cH639tpY8R+bmFZ4vYPwHfFmE2RmOLZa69N0 29+H2g5iYblJ5GBCuLiNrHtEXUjwLod6CTIAaBCaAy0CqW5menJ/Og8wFT63cW4PDT HBUm7yhmyMCAQ== Date: Sun, 23 Apr 2023 11:50:49 +0100 From: Jonathan Cameron To: Jiakai Luo Cc: Lars-Peter Clausen , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Ksenija Stanojevic , Lee Jones , Marek Vasut , hust-os-kernel-patches@googlegroups.com, linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] iio: adc: mxs-lradc: fix the order of two cleanup operations Message-ID: <20230423115049.1c73600f@jic23-huawei> In-Reply-To: <20230417024745.59614-1-jkluo@hust.edu.cn> References: <20230417024745.59614-1-jkluo@hust.edu.cn> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.37; 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-20230423_033515_695123_084CA1F8 X-CRM114-Status: GOOD ( 25.30 ) 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 Sun, 16 Apr 2023 19:47:45 -0700 Jiakai Luo wrote: > Smatch reports: > drivers/iio/adc/mxs-lradc-adc.c:766 mxs_lradc_adc_probe() warn: > missing unwind goto? > > the order of three init operation: > 1.mxs_lradc_adc_trigger_init > 2.iio_triggered_buffer_setup > 3.mxs_lradc_adc_hw_init > > thus, the order of three cleanup operation should be: > 1.mxs_lradc_adc_hw_stop > 2.iio_triggered_buffer_cleanup > 3.mxs_lradc_adc_trigger_remove > > we exchange the order of two cleanup operations, > introducing the following differences: > 1.if mxs_lradc_adc_trigger_init fails, returns directly; > 2.if trigger_init succeeds but iio_triggered_buffer_setup fails, > goto err_trig and remove the trigger. > > In addition, we also reorder the unwind that goes on in the > remove() callback to match the new ordering. > > Fixes: 6dd112b9f85e ("iio: adc: mxs-lradc: Add support for ADC driver") > Signed-off-by: Jiakai Luo > Reviewed-by: Dongliang Mu If resending please state why. I'm guessing on this occasion it was because you realised a fresh thread is expected for a new patch. Also, even if you are just amending the patch description, please increase the version number so that we can be sure we are looking at latest version. I already picked it from the earlier posting and this appears unchanged so all's well that ends well! Jonathan > --- > The issue is found by static analysis and remains untested. > --- > drivers/iio/adc/mxs-lradc-adc.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c > index bca79a93cbe4..85882509b7d9 100644 > --- a/drivers/iio/adc/mxs-lradc-adc.c > +++ b/drivers/iio/adc/mxs-lradc-adc.c > @@ -757,13 +757,13 @@ static int mxs_lradc_adc_probe(struct platform_device *pdev) > > ret = mxs_lradc_adc_trigger_init(iio); > if (ret) > - goto err_trig; > + return ret; > > ret = iio_triggered_buffer_setup(iio, &iio_pollfunc_store_time, > &mxs_lradc_adc_trigger_handler, > &mxs_lradc_adc_buffer_ops); > if (ret) > - return ret; > + goto err_trig; > > adc->vref_mv = mxs_lradc_adc_vref_mv[lradc->soc]; > > @@ -801,9 +801,9 @@ static int mxs_lradc_adc_probe(struct platform_device *pdev) > > err_dev: > mxs_lradc_adc_hw_stop(adc); > - mxs_lradc_adc_trigger_remove(iio); > -err_trig: > iio_triggered_buffer_cleanup(iio); > +err_trig: > + mxs_lradc_adc_trigger_remove(iio); > return ret; > } > > @@ -814,8 +814,8 @@ static int mxs_lradc_adc_remove(struct platform_device *pdev) > > iio_device_unregister(iio); > mxs_lradc_adc_hw_stop(adc); > - mxs_lradc_adc_trigger_remove(iio); > iio_triggered_buffer_cleanup(iio); > + mxs_lradc_adc_trigger_remove(iio); > > return 0; > } _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel