diff mbox series

[v2,1/1] gpio: mxc: use platform_get_irq_optional() to avoid an error message

Message ID 20230509160016.1074446-1-shenwei.wang@nxp.com
State New
Headers show
Series [v2,1/1] gpio: mxc: use platform_get_irq_optional() to avoid an error message | expand

Commit Message

Shenwei Wang May 9, 2023, 4 p.m. UTC
From: Fugang Duan <fugang.duan@nxp.com>

Use platform_get_irq_optional() to avoid an error message for the
optional irq.

Restructuring the codes to ask for the first mandatory IRQ before
the optional one.

Fixes: 7723f4c5ecdb ("driver core: platform: Add an error message to platform_get_irq*()")
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
---
 v2:
  - restructuring the codes per Andy Shevchenko's review

 drivers/gpio/gpio-mxc.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--
2.34.1
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index 9d0cec4b82a3..b8fa44a3fd4c 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -405,16 +405,16 @@  static int mxc_gpio_probe(struct platform_device *pdev)
 	if (irq_count < 0)
 		return irq_count;

-	if (irq_count > 1) {
-		port->irq_high = platform_get_irq(pdev, 1);
-		if (port->irq_high < 0)
-			port->irq_high = 0;
-	}
-
 	port->irq = platform_get_irq(pdev, 0);
 	if (port->irq < 0)
 		return port->irq;

+	if (irq_count > 1) {
+		err = platform_get_irq_optional(pdev, 1);
+		if (err > 0)
+			port->irq_high = err;
+	}
+
 	/* the controller clock is optional */
 	port->clk = devm_clk_get_optional(&pdev->dev, NULL);
 	if (IS_ERR(port->clk))