Thread (5 messages) 5 messages, 3 authors, 2021-08-02
STALE1788d

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

From: Tang Bin <hidden>
Date: 2021-07-27 12:51:55
Also in: linux-iio, lkml
Subsystem: iio subsystem and drivers, the rest · Maintainers: Jonathan Cameron, Linus Torvalds

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 <redacted>
Signed-off-by: Zhang Shengju <redacted>
Signed-off-by: Tang Bin <redacted>
---
 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");
-- 
2.20.1.windows.1




_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help