pinctrl: sirf: atlas7: fix of_irq_get() error check
Subsystems (2)
PATCH 1/1 pinctrl: sirf: atlas7: fix of_irq_get() error check
of_irq_get() may return any negative error number as well as 0 on failure, while the driver only checks for -EPROBE_DEFER, blithely continuing with the call to gpiochip_set_chained_irqchip() -- that function expects the parent IRQ as *unsigned int*, so would probably do nothing when a large IRQ number resulting from a conversion of a negative error number is passed to it, however passing 0 would probably work but the driver won't receive valid GPIO bank interrupts.
Check for 'ret <= 0' instead and return -ENXIO from the driver's probe iff of_irq_get() returned 0.
---
The patch is against the 'fixes' branch of Linus W.'s 'linux-pinctrl.git' repo.
drivers/pinctrl/sirf/pinctrl-atlas7.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pinctrl/sirf/pinctrl-atlas7.c +3 -1
@@ -6081,9 +6081,11 @@ static int atlas7_gpio_probe(struct plat/* Get interrupt number from DTS */ ret =of_irq_get (np, idx); -if (ret == -EPROBE_DEFER ) { +if (ret <=0 ) {dev_err (&pdev->dev,"Unable to find IRQ number. ret=%d\n" , ret); +if (!ret) + ret = -ENXIO ; goto failed; } bank->irq = ret;
PATCH 1/1 pinctrl: sirf: atlas7: fix of_irq_get() error check
Quoted 8 lines · Sergei Shtylyov
of_irq_get()may return any negative error number as well as 0 on failure, while the driver only checks for -EPROBE_DEFER, blithely continuing with the call togpiochip_set_chained_irqchip()-- that function expects the parent IRQ as *unsigned int*, so would probably do nothing when a large IRQ number resulting from a conversion of a negative error number is passed to it, however passing 0 would probably work but the driver won't receive valid GPIO bank interrupts.
Quoted 5 lines
Check for 'ret <= 0' instead and return
-ENXIOfrom the driver's probe iffof_irq_get()returned 0.Fixes f9367793293d ("pinctrl: sirf: add sirf atlas7 pinctrl and gpio support")Signed-off-by Sergei Shtylyov <[email protected]>
Patch applied!
Yours,
Linus Walleij
PATCH 1/1 pinctrl: sirf: atlas7: fix of_irq_get() error check
Quoted 8 lines · Linus Walleij
Quoted 8 lines
of_irq_get()may return any negative error number as well as 0 on failure, while the driver only checks for -EPROBE_DEFER, blithely continuing with the call togpiochip_set_chained_irqchip()-- that function expects the parent IRQ as *unsigned int*, so would probably do nothing when a large IRQ number resulting from a conversion of a negative error number is passed to it, however passing 0 would probably work but the driver won't receive valid GPIO bank interrupts.
Quoted 7 lines
Quoted 5 lines
Check for 'ret <= 0' instead and return
-ENXIOfrom the driver's probe iffof_irq_get()returned 0.Fixes f9367793293d ("pinctrl: sirf: add sirf atlas7 pinctrl and gpio support")Signed-off-by Sergei Shtylyov <[email protected]>Patch applied!
Thanks! But to which branch? I'm not seeing it in linux-pinctrl.git...
Quoted 2 lines
Yours,
Linus Walleij
MBR, Sergei
PATCH 1/1 pinctrl: sirf: atlas7: fix of_irq_get() error check
Quoted 21 lines · Sergei Shtylyov
Quoted 19 lines · Linus Walleij
Quoted 17 lines
of_irq_get()may return any negative error number as well as 0 on failure,
while the driver only checks for -EPROBE_DEFER, blithely continuing with the call togpiochip_set_chained_irqchip()-- that function expects the parent IRQ as *unsigned int*, so would probably do nothing when a large IRQ number resulting from a conversion of a negative error number is passed
to it, however passing 0 would probably work but the driver won't receive valid GPIO bank interrupts.Check for 'ret <= 0' instead and return
-ENXIOfrom the driver's probe iffof_irq_get()returned 0.Fixes f9367793293d ("pinctrl: sirf: add sirf atlas7 pinctrl and gpiosupport")
Signed-off-by Sergei Shtylyov <[email protected]>
Quoted 4 lines
Quoted 1 line
Patch applied!
Thanks! But to which branch? I'm not seeing it in linux-pinctrl.git...
devel.
It seems the SiRF people are not using upstream (see other mails) so I do not see we need to expediate it to fixes.
Yours,
Linus Walleij
PATCH 1/1 pinctrl: sirf: atlas7: fix of_irq_get() error check
Hello!
Quoted 19 lines · Linus Walleij
Quoted 19 lines
Quoted 19 lines
Quoted 17 lines
of_irq_get()may return any negative error number as well as 0 on failure,
while the driver only checks for -EPROBE_DEFER, blithely continuing with the call togpiochip_set_chained_irqchip()-- that function expects the parent IRQ as *unsigned int*, so would probably do nothing when a large IRQ number resulting from a conversion of a negative error number is passed
to it, however passing 0 would probably work but the driver won't receive valid GPIO bank interrupts.Check for 'ret <= 0' instead and return
-ENXIOfrom the driver's probe iffof_irq_get()returned 0.Fixes f9367793293d ("pinctrl: sirf: add sirf atlas7 pinctrl and gpiosupport")
Signed-off-by Sergei Shtylyov <[email protected]>
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Patch applied!
Thanks! But to which branch? I'm not seeing it in linux-pinctrl.git...
devel.
Still not seeing the patch, perhaps you forgot to push?
Quoted 2 lines
It seems the SiRF people are not using upstream (see other mails) so I do not see we need to expediate it to fixes.
Up to you.
Quoted 2 lines
Yours,
Linus Walleij
MBR, Sergei
PATCH 1/1 pinctrl: sirf: atlas7: fix of_irq_get() error check
Quoted 29 lines · Sergei Shtylyov
Quoted 27 lines · Linus Walleij
Quoted 27 lines
Quoted 24 lines
Quoted 13 lines
of_irq_get()may return any negative error number as well as 0 on failure,
while the driver only checks for -EPROBE_DEFER, blithely continuing with
the call togpiochip_set_chained_irqchip()-- that function expects the parent IRQ as *unsigned int*, so would probably do nothing when a large
IRQ number resulting from a conversion of a negative error number is passed
to it, however passing 0 would probably work but the driver won't receive
valid GPIO bank interrupts.Quoted 7 lines
Check for 'ret <= 0' instead and return
-ENXIOfrom the driver's probe iffof_irq_get()returned 0.Fixes f9367793293d ("pinctrl: sirf: add sirf atlas7 pinctrl and gpiosupport")
Signed-off-by Sergei Shtylyov <[email protected]>Patch applied!
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Thanks! But to which branch? I'm not seeing it in linux-pinctrl.git...
devel.
Still not seeing the patch, perhaps you forgot to push?
Nah just haven't had time to push yet...
My mailbox is filling up with new patches at the same pace that I apply them it seems.
Linus
PATCH 1/1 pinctrl: sirf: atlas7: fix of_irq_get() error check
Quoted 23 lines · Linus Walleij
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 22 lines
Quoted 13 lines
of_irq_get()may return any negative error number as well as 0 on failure,
while the driver only checks for -EPROBE_DEFER, blithely continuing with
the call togpiochip_set_chained_irqchip()-- that function expects the parent IRQ as *unsigned int*, so would probably do nothing when a large
IRQ number resulting from a conversion of a negative error number is passed
to it, however passing 0 would probably work but the driver won't receive
valid GPIO bank interrupts.Quoted 7 lines
Check for 'ret <= 0' instead and return
-ENXIOfrom the driver's probe iffof_irq_get()returned 0.Fixes f9367793293d ("pinctrl: sirf: add sirf atlas7 pinctrl and gpiosupport")
Signed-off-by Sergei Shtylyov <[email protected]>Patch applied!
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Thanks! But to which branch? I'm not seeing it in linux-pinctrl.git...
devel.
Still not seeing the patch, perhaps you forgot to push?
Nah just haven't had time to push yet...
Ah... seeing the patches now, thanks!
Quoted 2 lines
My mailbox is filling up with new patches at the same pace that I apply them it seems.
The joys of being a maintainer. :-)
Quoted 1 line
Linus
MBR, Sergei