提交 b9f27afb 编写于 作者: S Sergei Shtylyov 提交者: Bjorn Helgaas

PCI: faraday: Fix of_irq_get() error check

of_irq_get() may return a negative error number as well as 0 on failure,
while the driver only checks for 0, blithely continuing with the call to
irq_set_chained_handler_and_data() -- that function expects *unsigned int*
so should probably do nothing when a large IRQ number resulting from a
conversion of a negative error number is passed to it. The driver then
probes successfully while being only partly functional...

Check for 'irq <= 0' instead and propagate the negative error number to the
probe method --  that will allow the deferred probing as well.

Fixes: d3c68e0a ("PCI: faraday: Add Faraday Technology FTPCI100 PCI Host Bridge driver")
Signed-off-by: NSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: NLinus Walleij <linus.walleij@linaro.org>
上级 0d58e6c1
...@@ -350,9 +350,9 @@ static int faraday_pci_setup_cascaded_irq(struct faraday_pci *p) ...@@ -350,9 +350,9 @@ static int faraday_pci_setup_cascaded_irq(struct faraday_pci *p)
/* All PCI IRQs cascade off this one */ /* All PCI IRQs cascade off this one */
irq = of_irq_get(intc, 0); irq = of_irq_get(intc, 0);
if (!irq) { if (irq <= 0) {
dev_err(p->dev, "failed to get parent IRQ\n"); dev_err(p->dev, "failed to get parent IRQ\n");
return -EINVAL; return irq ?: -EINVAL;
} }
p->irqdomain = irq_domain_add_linear(intc, 4, p->irqdomain = irq_domain_add_linear(intc, 4,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册