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 X-Spam-Level: X-Spam-Status: No, score=-16.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C54CC4338F for ; Sat, 31 Jul 2021 16:44:59 +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 5411B60D07 for ; Sat, 31 Jul 2021 16:44:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5411B60D07 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=lbIWzgbn0hTbNoJlQvx8fShMqLW5GDXoRMLesF0kOp4=; b=WMhjSFWgUb0/Iu 3ZYYAE1VWZiZNOpDsZd4TuPuj4iISbLefYIW5o4/tLoIcz5S9rShicoc6ltzP5gHAwQvU7s5B2Sti xHME+u8LO26ttWOGnuLkg5dqPy5BmdLJd+k4rV29l+BVfosWcij9flaWNiSkiVxRRQkxkc/qmit93 pQyemP0qj8S2OotPgXT2q2E/3oAJjElWAsauDtHETCx5BVsht+PL7zYqS/yf5AeqrtzUJxFhxV08A 8j5FjJlP80SmP6YaW+q9Ynea1X6tc1DPe2l0ixxIr6XMQPb8Y9kD7iK9PCVM7yaogvXFOvG/eCWt9 D/SLEwPPsOTx3cOz7oLQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m9s52-00BvAX-Bv; Sat, 31 Jul 2021 16:43:20 +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 1m9s4y-00BvAB-2S for linux-arm-kernel@lists.infradead.org; Sat, 31 Jul 2021 16:43:17 +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 DF14360D07; Sat, 31 Jul 2021 16:43:11 +0000 (UTC) Date: Sat, 31 Jul 2021 17:45:51 +0100 From: Jonathan Cameron To: Tang Bin Cc: knaack.h@gmx.de, lars@metafoo.de, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Zhang Shengju Subject: Re: [PATCH] iio: adc: fsl-imx25-gcq: fix the right check and simplify code Message-ID: <20210731174551.188aee79@jic23-huawei> In-Reply-To: <20210727125209.28248-1-tangbin@cmss.chinamobile.com> References: <20210727125209.28248-1-tangbin@cmss.chinamobile.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-20210731_094316_182927_63BDF872 X-CRM114-Status: GOOD ( 25.17 ) 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 Tue, 27 Jul 2021 20:52:09 +0800 Tang Bin wrote: > For the function of platform_get_irq(), the example in platform.c is > * int irq = platform_get_irq(pdev, 0); > * if (irq < 0) > * return irq; > So the return value of zero is unnecessary to check. And move it > up to a little bit can simplify the code jump. > > Co-developed-by: Zhang Shengju > Signed-off-by: Zhang Shengju > Signed-off-by: Tang Bin Hi, Logically it is better to keep the irq handling all together, so I would prefer we didn't move it. Also, platform_get_irq() is documented as never returning 0, so the current code is not incorrect. As such, this looks like noise unless there is some plan to make use of the 0 return value? What benefit do we get from this change? Thanks, Jonathan > --- > drivers/iio/adc/fsl-imx25-gcq.c | 12 ++++-------- > 1 file changed, 4 insertions(+), 8 deletions(-) > > diff --git a/drivers/iio/adc/fsl-imx25-gcq.c b/drivers/iio/adc/fsl-imx25-gcq.c > index 8cb51cf7a..d28976f21 100644 > --- a/drivers/iio/adc/fsl-imx25-gcq.c > +++ b/drivers/iio/adc/fsl-imx25-gcq.c > @@ -320,6 +320,10 @@ static int mx25_gcq_probe(struct platform_device *pdev) > if (ret) > return ret; > > + priv->irq = platform_get_irq(pdev, 0); > + if (priv->irq < 0) > + return priv->irq; > + > for (i = 0; i != 4; ++i) { > if (!priv->vref[i]) > continue; > @@ -336,14 +340,6 @@ static int mx25_gcq_probe(struct platform_device *pdev) > goto err_vref_disable; > } > > - priv->irq = platform_get_irq(pdev, 0); > - if (priv->irq <= 0) { > - ret = priv->irq; > - if (!ret) > - ret = -ENXIO; > - goto err_clk_unprepare; > - } > - > ret = request_irq(priv->irq, mx25_gcq_irq, 0, pdev->name, priv); > if (ret) { > dev_err(dev, "Failed requesting IRQ\n"); _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel