gpio: xgs-iproc: fix parsing of ngpios property
Subsystems (2)
PATCH 1/1 gpio: xgs-iproc: fix parsing of ngpios property
of_property_read_u32 returns 0 on success, not true, so we need to invert the check to actually take over the provided ngpio value.
---
This is based ongit://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git,
which is the tree for GPIO according to MAINTAINERS, but hasn't been updated since ~5.11 - is this still the correct tree?
It doesn't matter much for this patch though, the driver is virtually untouched since then.
drivers/gpio/gpio-xgs-iproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-xgs-iproc.c +1 -1
@@ -224,7 +224,7 @@ static int iproc_gpio_probe(struct platform_device *pdev) } chip->gc.label =dev_name (dev); -if (of_property_read_u32 (dn,"ngpios" , &num_gpios)) +if (!of_property_read_u32 (dn,"ngpios" , &num_gpios)) chip->gc.ngpio = num_gpios; irq =platform_get_irq (pdev,0 );
Signature · 1 line
2.33.0
Quoted 5 lines · Jonas Gorski
of_property_read_u32returns 0 on success, not true, so we need to invert the check to actually take over the provided ngpio value.Fixes 6a41b6c5fc20 ("gpio: Add xgs-iproc driver")Signed-off-by Jonas Gorski <[email protected]>
Hmm I must have copied some error handling code and failed to invert the condition when I made the property optional.
Quoted 25 lines
---
This is based ongit://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git,
which is the tree for GPIO according toMAINTAINERS, but hasn't been updated since ~5.11 - is this still the correct tree?It doesn't matter much for this patch though, the driver is virtually untouched since then.
drivers/gpio/gpio-xgs-iproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpio/gpio-xgs-iproc.c +1
-1@@ -224,7 +224,7 @@ static int iproc_gpio_probe(struct platform_device *pdev) } chip->gc.label =dev_name (dev); -if (of_property_read_u32 (dn,"ngpios" , &num_gpios)) +if (!of_property_read_u32 (dn,"ngpios" , &num_gpios)) chip->gc.ngpio = num_gpios; irq =platform_get_irq (pdev,0 );
Quoted 5 lines · Jonas Gorski
of_property_read_u32returns 0 on success, not true, so we need to invert the check to actually take over the provided ngpio value.Fixes 6a41b6c5fc20 ("gpio: Add xgs-iproc driver")Signed-off-by Jonas Gorski <[email protected]>
Signature · 1 line
Florian
Quoted 5 lines · Jonas Gorski
of_property_read_u32returns 0 on success, not true, so we need to invert the check to actually take over the provided ngpio value.Fixes 6a41b6c5fc20 ("gpio: Add xgs-iproc driver")Signed-off-by Jonas Gorski <[email protected]>
Yours,
Linus Walleij
Quoted 32 lines · Jonas Gorski
of_property_read_u32returns 0 on success, not true, so we need to invert the check to actually take over the provided ngpio value.Fixes 6a41b6c5fc20 ("gpio: Add xgs-iproc driver")Signed-off-by Jonas Gorski <[email protected]>---
This is based ongit://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git,
which is the tree for GPIO according toMAINTAINERS, but hasn't been updated since ~5.11 - is this still the correct tree?It doesn't matter much for this patch though, the driver is virtually untouched since then.
drivers/gpio/gpio-xgs-iproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpio/gpio-xgs-iproc.c +1
-2@@ -224,7 +224,7 @@ static int iproc_gpio_probe(struct platform_device *pdev) } chip->gc.label =dev_name (dev); -if (of_property_read_u32 (dn,"ngpios" , &num_gpios)) +if (!of_property_read_u32 (dn,"ngpios" , &num_gpios)) chip->gc.ngpio = num_gpios; irq =platform_get_irq (pdev,0 ); --
Quoted 2 lines
2.33.0
Queued for fixes.
Bart
drivers/gpio/gpio-xgs-iproc.c static int iproc_gpio_probe(struct platform_device *pdev) · line 228
Quoted 7 lines · Jonas Gorski
of_property_read_u32returns 0 on success, not true, so we need to invert the check to actually take over the provided ngpio value.drivers/gpio/gpio-xgs-iproc.c +1
-1-if (of_property_read_u32 (dn,"ngpios" , &num_gpios)) +if (!of_property_read_u32 (dn,"ngpios" , &num_gpios)) chip->gc.ngpio = num_gpios;
Just a side note: I'm wondering how many of such we have in the drivers and why we can't simply do it under the OF GPIO library's hood for everybody.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 10 lines · Andy Shevchenko
drivers/gpio/gpio-xgs-iproc.c static int iproc_gpio_probe(struct platform_device *pdev) · line 228
Quoted 7 lines · Jonas Gorski
of_property_read_u32returns 0 on success, not true, so we need to invert the check to actually take over the provided ngpio value.drivers/gpio/gpio-xgs-iproc.c +1
-1-if (of_property_read_u32 (dn,"ngpios" , &num_gpios)) +if (!of_property_read_u32 (dn,"ngpios" , &num_gpios)) chip->gc.ngpio = num_gpios;
Quoted 7 lines
Just a side note: I'm wondering how many of such we have in the drivers and why we can't simply do it under the OF GPIO library's hood for everybody.
--
With Best Regards,
Andy Shevchenko
Looks like we have 17, so yes, definitely a candidate for pulling into the GPIO core.
Bart