From: Jonathan Cameron <jic23@kernel.org>
To: Tang Bin <tangbin@cmss.chinamobile.com>
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 <zhangshengju@cmss.chinamobile.com>
Subject: Re: [PATCH v2] iio: adc: fsl-imx25-gcq: fix the right check and simplify code
Date: Sun, 8 Aug 2021 14:54:31 +0100 [thread overview]
Message-ID: <20210808145431.5164b2d8@jic23-huawei> (raw)
In-Reply-To: <20210802120929.33760-1-tangbin@cmss.chinamobile.com>
On Mon, 2 Aug 2021 20:09:29 +0800
Tang Bin <tangbin@cmss.chinamobile.com> 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 <zhangshengju@cmss.chinamobile.com>
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
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");
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2021-08-08 13:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-02 12:09 [PATCH v2] iio: adc: fsl-imx25-gcq: fix the right check and simplify code Tang Bin
2021-08-08 13:54 ` Jonathan Cameron [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210808145431.5164b2d8@jic23-huawei \
--to=jic23@kernel.org \
--cc=festevam@gmail.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=tangbin@cmss.chinamobile.com \
--cc=zhangshengju@cmss.chinamobile.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox