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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Fugang Duan <fugang.duan@xxxxxxx>

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@xxxxxxx>
Signed-off-by: Shenwei Wang <shenwei.wang@xxxxxxx>
---
 v2:
  - restructuring the codes per Andy Shevchenko's review

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

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))
--
2.34.1




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux