Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp1952959pxt; Sun, 8 Aug 2021 06:53:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOByaqMog40yFGkSBkqn4/7IgaTA0NgX1IGbGNv0R2OJKJHlqf/QLWw6Vv6kB6ZH43cwJS X-Received: by 2002:a17:906:1da1:: with SMTP id u1mr17973163ejh.307.1628430829900; Sun, 08 Aug 2021 06:53:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628430829; cv=none; d=google.com; s=arc-20160816; b=e6Ib7bVaR/RhxUTS2tTG7yScpD2OXdR7f8Hx0mY3n1hOs2u8/JC99wEIkeICCyH9i4 DGWSELXHmpJYBJWDxWi/dkhXVVtC3a9avAtjB4yVH2WfHT/k6o/cmiIpBhJlC1beFs/S 5Wxu+0S+W5Qjj23/wWJk4kuDrzAT7L92yg/ctCdZwLHC1prpozepgwF5hMKfIJgpt1lJ sGRht08ch6LYu45E1FI7DHPJ60/cv7VfMVg9FHpFucP4UFFckKQpRpEDSaEyoftgkCKc FqKVbjMFbUvi+dyNvAtYj3GLCZK00lzcRiLaqlwBHtUBRybOgvUXjG7p8nWD1duVvjQV Fo7A== 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=pDcuu3AUBRE4wf1kR3uHSzFpgx/dr1rloMKX0KTrZsw=; b=aT9xUzYQKn8SgxyVqv7n+R0XnDSuMvbd0EoNB4urCsUxYhjX4Vc2Ln/6JF0FyMq/GP Lx88PsnvrIA2/iC9y/FwMkCH73T99ACmfj345V8GoTrSgWsCbZmbVs+En3ocTnC7VEIG AEYQUHLyPuQWKD1vw2VIWFiLJMuSSt8KcuNqkbUG/ZbYXTfMRBV4gK4eBG63MnTKRWy+ eupv0UlxUV1t2qesGBuynLOyDAYxADipjgSZ+dtaYKKnd38tYmBcqwyKCMyX8YldxT9y magHCTqg+Po57YDVZt3mubmgHknJBzjDZYEszCo7dmC0JE742UmkmiSz2bN0+4KKB6Am szmg== 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 f3si14276552ejj.302.2021.08.08.06.53.26; Sun, 08 Aug 2021 06:53:49 -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 S231618AbhHHNwE (ORCPT + 99 others); Sun, 8 Aug 2021 09:52:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:59624 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229504AbhHHNwE (ORCPT ); Sun, 8 Aug 2021 09:52: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 EE0E060ED6; Sun, 8 Aug 2021 13:51:41 +0000 (UTC) Date: Sun, 8 Aug 2021 14:54:31 +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 v2] iio: adc: fsl-imx25-gcq: fix the right check and simplify code Message-ID: <20210808145431.5164b2d8@jic23-huawei> In-Reply-To: <20210802120929.33760-1-tangbin@cmss.chinamobile.com> References: <20210802120929.33760-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 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2 Aug 2021 20:09:29 +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; > the return value of zero is unnecessary to check, so make the right > check and simplify code. > > Co-developed-by: Zhang Shengju > Signed-off-by: Zhang Shengju > Signed-off-by: Tang Bin Applied. I tweaked the message an title to make it clear this isn't a fix, but rather a little clean up with no functional affect. Thanks, Jonathan > --- > Changes from v1 > - change the code to the original place and make it simple. > - change the commit message. > --- > drivers/iio/adc/fsl-imx25-gcq.c | 9 +++------ > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/drivers/iio/adc/fsl-imx25-gcq.c b/drivers/iio/adc/fsl-imx25-gcq.c > index 8cb51cf7a..2cdf45aa8 100644 > --- a/drivers/iio/adc/fsl-imx25-gcq.c > +++ b/drivers/iio/adc/fsl-imx25-gcq.c > @@ -336,14 +336,11 @@ 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; > + ret = platform_get_irq(pdev, 0); > + if (ret < 0) > goto err_clk_unprepare; > - } > > + priv->irq = ret; > ret = request_irq(priv->irq, mx25_gcq_irq, 0, pdev->name, priv); > if (ret) { > dev_err(dev, "Failed requesting IRQ\n");