diff mbox series

[v2] iio: adc: fsl-imx25-gcq: fix the right check and simplify code

Message ID 20210802120929.33760-1-tangbin@cmss.chinamobile.com (mailing list archive)
State Accepted
Headers show
Series [v2] iio: adc: fsl-imx25-gcq: fix the right check and simplify code | expand

Commit Message

Tang Bin Aug. 2, 2021, 12:09 p.m. UTC
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>
---
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(-)

Comments

Jonathan Cameron Aug. 8, 2021, 1:54 p.m. UTC | #1
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");
diff mbox series

Patch

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");