diff options
author | Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> | 2017-07-16 00:43:10 +0300 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2017-08-16 19:42:28 +0300 |
commit | b9f27afbc0b8c664c083def0319050466de9621a (patch) | |
tree | c430d2199dc469413c229cd8228e2cdf1d6d8629 /drivers/pci/host | |
parent | 0d58e6c1b19b30623b5f0a053818bd2c32d61166 (diff) | |
download | linux-b9f27afbc0b8c664c083def0319050466de9621a.tar.xz |
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: d3c68e0a7e34 ("PCI: faraday: Add Faraday Technology FTPCI100 PCI Host Bridge driver")
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pci/host')
-rw-r--r-- | drivers/pci/host/pci-ftpci100.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/pci/host/pci-ftpci100.c b/drivers/pci/host/pci-ftpci100.c index 5162dffc102b..3f5d224e7b1a 100644 --- a/drivers/pci/host/pci-ftpci100.c +++ b/drivers/pci/host/pci-ftpci100.c @@ -350,9 +350,9 @@ static int faraday_pci_setup_cascaded_irq(struct faraday_pci *p) /* All PCI IRQs cascade off this one */ irq = of_irq_get(intc, 0); - if (!irq) { + if (irq <= 0) { dev_err(p->dev, "failed to get parent IRQ\n"); - return -EINVAL; + return irq ?: -EINVAL; } p->irqdomain = irq_domain_add_linear(intc, 4, |