gpio-tz1090: fix error handling of irq_of_parse_and_map
PATCH 1/1 gpio-tz1090: fix error handling of irq_of_parse_and_map
irq_of_parse_and_map() returns 0 on error, so testing for negative result never works.
---
Not tested, found by casual inspection of the code.
drivers/gpio/gpio-tz1090.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-tz1090.c +1 -1
@@ -446,7 +446,7 @@ static int tz1090_gpio_bank_probe(struct tz1090_gpio_bank_info *info) bank->irq =irq_of_parse_and_map (np,0 );/* The interrupt is optional (it may be used by another core on chip) */ -if (bank->irq <0 ) { +if (!bank->irq) {dev_info (dev,"IRQ not provided for bank %u, IRQs disabled\n" , info->index);return 0 ;
Signature · 5 lines
2.1.0.rc2.206.gedb03e5 -- Dmitry
Quoted 4 lines · Dmitry Torokhov
irq_of_parse_and_map()returns 0 on error, so testing for negative result never works.Signed-off-by Dmitry Torokhov <[email protected]>
Good catch, thanks!
A quick coccinelle script shows up numerous other cases of this error around the kernel tree too...
Cheers
James
Quoted 26 lines
---
Not tested, found by casual inspection of the code.
drivers/gpio/gpio-tz1090.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpio/gpio-tz1090.c +1
-1@@ -446,7 +446,7 @@ static int tz1090_gpio_bank_probe(struct tz1090_gpio_bank_info *info) bank->irq =irq_of_parse_and_map (np,0 );/* The interrupt is optional (it may be used by another core on chip) */ -if (bank->irq <0 ) { +if (!bank->irq) {dev_info (dev,"IRQ not provided for bank %u, IRQs disabled\n" , info->index);return 0 ;Signature · 5 lines
2.1.0.rc2.206.gedb03e5 -- Dmitry
Quoted 4 lines · James Hogan
Quoted 3 lines · Dmitry Torokhov
irq_of_parse_and_map()returns 0 on error, so testing for negative result never works.
Quoted 8 lines
Quoted 1 line
Signed-off-by Dmitry Torokhov <[email protected]>Good catch, thanks!
Acked-by James Hogan <[email protected]>A quick coccinelle script shows up numerous other cases of this error around the kernel tree too...
Yeah, I sent out a few patches today.
Thanks,
Dmitry
Quoted 4 lines · Dmitry Torokhov
irq_of_parse_and_map()returns 0 on error, so testing for negative result never works.Signed-off-by Dmitry Torokhov <[email protected]>
Patch applied with James' ACK.
Yours,
Linus Walleij