Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp1567640pxy; Mon, 2 Aug 2021 05:11:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgNOSWKljsHuHDQvESSzxpRzozxeHj1lxjSDuvvtWGg/rMaBbD1QE7R3jLigrbmsTKObeU X-Received: by 2002:a02:cb4d:: with SMTP id k13mr1518888jap.31.1627906286819; Mon, 02 Aug 2021 05:11:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627906286; cv=none; d=google.com; s=arc-20160816; b=GLmTrQyKJTO54q4hGiSmx6krzK6M3uE5u0cNbaaUEZ/np126CtCjhO3U/ZCn48jNP3 qAxQDideKl1z6aPcxW0LbkIghSaZQgRs2w8W86dTfLxSwhb329sjK9TkKjqNYwDFMtzD ggecMtzdwVMqCFRsiYD4YN/IhSNFvh6luZuSauXO5KLTlDhSTKvo0LfCqxJnUtd/jDuW RELUtic+VRofogAfMzi1HkYOWmX4QeLPWBOvViw4iF9B5YDUqaN4JG/P65Eii9d1LKDb IWG5JL9Q4SD5qyIjhrXHYFwiw6aHKik9pWZJ/twQU1tVCxP+cQV66jgwOXe2C1rvpFxS bAZg== 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 :message-id:date:subject:cc:to:from; bh=0GdFFCxZ5w+WLioLstylLP5x+ET5OrCRGz3inlBq2c0=; b=06Asz4Z1rI+qCVFw2hVgOSbnto7EPZt3w7GZ0ydMjygkJXqo9DOsGf5Ll7l7AZRcBg YqBl75DFoxYxiFehV2XAsXKMp9AxtyiQGgE8AgNHRiFSZzYgMA0oixdthAU5j9Nop1s8 JaoYpJPNqtm2Q/gcv8eX+YrhJqDlx28sDts8JA0spWKBXRsN6SyWN2BKZ1kCRf1whusv DYt5C+9h6VTDaqOvt4ZCilWRc0WDn+wzyay0GkLo/gfDzPgC2R+XtuTzpR031GOB+4E8 uya4wRLxYEFCMGrN9DKAET8oTpfjPX0lPHG3HH0tJxmDXbB65vGRJulHWadD1MQ3ApcY j42Q== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g15si12707702ilc.45.2021.08.02.05.11.15; Mon, 02 Aug 2021 05:11:26 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233558AbhHBMJm (ORCPT + 99 others); Mon, 2 Aug 2021 08:09:42 -0400 Received: from cmccmta3.chinamobile.com ([221.176.66.81]:25708 "EHLO cmccmta3.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233446AbhHBMJm (ORCPT ); Mon, 2 Aug 2021 08:09:42 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.5]) by rmmx-syy-dmz-app10-12010 (RichMail) with SMTP id 2eea6107e06c852-e82ce; Mon, 02 Aug 2021 20:09:19 +0800 (CST) X-RM-TRANSID: 2eea6107e06c852-e82ce X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from localhost.localdomain (unknown[223.112.105.130]) by rmsmtp-syy-appsvr03-12003 (RichMail) with SMTP id 2ee36107e06b2e6-80095; Mon, 02 Aug 2021 20:09:19 +0800 (CST) X-RM-TRANSID: 2ee36107e06b2e6-80095 From: Tang Bin To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com Cc: linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Tang Bin , Zhang Shengju Subject: [PATCH v2] iio: adc: fsl-imx25-gcq: fix the right check and simplify code Date: Mon, 2 Aug 2021 20:09:29 +0800 Message-Id: <20210802120929.33760-1-tangbin@cmss.chinamobile.com> X-Mailer: git-send-email 2.20.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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"); -- 2.20.1.windows.1