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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABE97C7EE29 for ; Sat, 10 Jun 2023 10:54:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229746AbjFJKyk (ORCPT ); Sat, 10 Jun 2023 06:54:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229639AbjFJKyj (ORCPT ); Sat, 10 Jun 2023 06:54:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC92C35B6; Sat, 10 Jun 2023 03:54:38 -0700 (PDT) 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 6A486612AE; Sat, 10 Jun 2023 10:54:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 335A7C4339B; Sat, 10 Jun 2023 10:54:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686394477; bh=0QL4JPqiS9rPR/J8636yim1R6Z9Esq9EoitzY1XDxRY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Ql2HMHMwRW4FUFZI1lVKn6agtm3I+pGHDGGoUT9Jy2J71zVZZpoLXUB4/LG/iPEXr PB1NrjDQYFH9BJvGngMHo47PZaSfUteZ9wAaQPW+S6bvNEbdC+Aed7VpWYHtcAEHvf 2uzwuDdTG/JzxcMRlKe+us9BJvah5caX3Phmlt20tSZU96m6wueb2/p8rF94SdNM7w Nf5lzTuXtuTznqqIF9Eu7luEXj1uNhnj1aqqPyuP/7UFfT1y/mwC73lqNBcPbJ1K/e u9jjpfC504UdF0J+9LgTlJLcQAeMTZ0Biy925ds7H9lNc+AT9YhBRH7Wc0gsXMwhNk i35yGz06OB9wQ== Date: Sat, 10 Jun 2023 12:54:34 +0200 From: Andi Shyti To: Shuai Jiang Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Wolfram Sang , "Ivan T. Ivanov" , Sricharan R , Naveen Kaje , Austin Christ , hust-os-kernel-patches@googlegroups.com, Andy Gross , linux-arm-msm@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] i2c: qup: Add missing unwind goto in qup_i2c_probe() Message-ID: <20230610105434.3jbo6svcct37pn3q@intel.intel> References: <20230418135612.598-1-d202180596@hust.edu.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230418135612.598-1-d202180596@hust.edu.cn> Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org On Tue, Apr 18, 2023 at 09:56:12PM +0800, Shuai Jiang wrote: > Smatch Warns: > drivers/i2c/busses/i2c-qup.c:1784 qup_i2c_probe() > warn: missing unwind goto? > > The goto label "fail_runtime" and "fail" will disable qup->pclk, > but here qup->pclk failed to obtain, in order to be consistent, > change the direct return to goto label "fail_dma". > > Fixes: 10c5a8425968 ("i2c: qup: New bus driver for the Qualcomm QUP I2C controller") > Fixes: 515da746983b ("i2c: qup: add ACPI support") These are not the correct Fixes, the correct fix is: Fixes: 9cedf3b2f099 ("i2c: qup: Add bam dma capabilities") > Signed-off-by: Shuai Jiang > Reviewed-by: Dongliang Mu and Cc: # v4.6+ Patch looks good: Reviewed-by: Andi Shyti Andi > --- > The issue is found by static analysis and remains untested. > --- > drivers/i2c/busses/i2c-qup.c | 21 ++++++++++++++------- > 1 file changed, 14 insertions(+), 7 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c > index 2e153f2f71b6..78682388e02e 100644 > --- a/drivers/i2c/busses/i2c-qup.c > +++ b/drivers/i2c/busses/i2c-qup.c > @@ -1752,16 +1752,21 @@ static int qup_i2c_probe(struct platform_device *pdev) > if (!clk_freq || clk_freq > I2C_MAX_FAST_MODE_PLUS_FREQ) { > dev_err(qup->dev, "clock frequency not supported %d\n", > clk_freq); > - return -EINVAL; > + ret = -EINVAL; > + goto fail_dma; > } > > qup->base = devm_platform_ioremap_resource(pdev, 0); > - if (IS_ERR(qup->base)) > - return PTR_ERR(qup->base); > + if (IS_ERR(qup->base)) { > + ret = PTR_ERR(qup->base); > + goto fail_dma; > + } > > qup->irq = platform_get_irq(pdev, 0); > - if (qup->irq < 0) > - return qup->irq; > + if (qup->irq < 0) { > + ret = qup->irq; > + goto fail_dma; > + } > > if (has_acpi_companion(qup->dev)) { > ret = device_property_read_u32(qup->dev, > @@ -1775,13 +1780,15 @@ static int qup_i2c_probe(struct platform_device *pdev) > qup->clk = devm_clk_get(qup->dev, "core"); > if (IS_ERR(qup->clk)) { > dev_err(qup->dev, "Could not get core clock\n"); > - return PTR_ERR(qup->clk); > + ret = PTR_ERR(qup->clk); > + goto fail_dma; > } > > qup->pclk = devm_clk_get(qup->dev, "iface"); > if (IS_ERR(qup->pclk)) { > dev_err(qup->dev, "Could not get iface clock\n"); > - return PTR_ERR(qup->pclk); > + ret = PTR_ERR(qup->pclk); > + goto fail_dma; > } > qup_i2c_enable_clocks(qup); > src_clk_freq = clk_get_rate(qup->clk); > -- > 2.25.1 >