gpio: mpc8xxx: Fix IRQ check in mpc8xxx_probe
PATCH 1/1 gpio: mpc8xxx: Fix IRQ check in mpc8xxx_probe
platform_get_irq() returns negative error number instead 0 on failure. And the doc of platform_get_irq() provides a usage example:
int irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;Fix the check of return value to catch errors correctly.
Fixes 76c47d1449fc ("gpio: mpc8xxx: Add ACPI support")
Signed-off-by Miaoqian Lin <[email protected]>
--- drivers/gpio/gpio-mpc8xxx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-mpc8xxx.c +2 -2
@@ -388,8 +388,8 @@ static int mpc8xxx_probe(struct platform_device *pdev) } mpc8xxx_gc->irqn =platform_get_irq (pdev,0 ); -if (!mpc8xxx_gc->irqn) -return 0 ; +if (mpc8xxx_gc->irqn <0 ) +return mpc8xxx_gc->irqn; mpc8xxx_gc->irq = irq_domain_create_linear(fwnode, MPC8XXX_GPIO_PINS,
Signature · 1 line
2.17.1
Quoted 11 lines · Miaoqian Lin
platform_get_irq()returns negative error number instead 0 on failure. And the doc ofplatform_get_irq()provides a usage example:int irq = platform_get_irq(pdev, 0); if (irq < 0) return irq;Fix the check of return value to catch errors correctly.
Fixes 76c47d1449fc ("gpio: mpc8xxx: Add ACPI support")Signed-off-by Miaoqian Lin <[email protected]>
Reviewed-by Linus Walleij <[email protected]>
Yours,
Linus Walleij
Bartosz Golaszewski
AppliedQuoted 32 lines · Miaoqian Lin
platform_get_irq()returns negative error number instead 0 on failure. And the doc ofplatform_get_irq()provides a usage example:int irq = platform_get_irq(pdev, 0); if (irq < 0) return irq;Fix the check of return value to catch errors correctly.
Fixes 76c47d1449fc ("gpio: mpc8xxx: Add ACPI support")Signed-off-by Miaoqian Lin <[email protected]>--- drivers/gpio/gpio-mpc8xxx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpio/gpio-mpc8xxx.c +2
-3@@ -388,8 +388,8 @@ static int mpc8xxx_probe(struct platform_device *pdev) } mpc8xxx_gc->irqn =platform_get_irq (pdev,0 ); -if (!mpc8xxx_gc->irqn) -return 0 ; +if (mpc8xxx_gc->irqn <0 ) +return mpc8xxx_gc->irqn; mpc8xxx_gc->irq = irq_domain_create_linear(fwnode, MPC8XXX_GPIO_PINS, --
Quoted 2 lines
2.17.1
Queued for fixes, thanks!
Bart