提交 48e43b3e 编写于 作者: S Sergei Shtylyov 提交者: Linus Walleij

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.

Fixes: f9367793 ("pinctrl: sirf: add sirf atlas7 pinctrl and gpio support")
Signed-off-by: NSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
上级 5fdd1a6a
......@@ -6082,9 +6082,11 @@ static int atlas7_gpio_probe(struct platform_device *pdev)
/* 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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册