aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of/of_pci_irq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/of/of_pci_irq.c')
-rw-r--r--drivers/of/of_pci_irq.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/of/of_pci_irq.c b/drivers/of/of_pci_irq.c
index 1710d9dc7fc2..2306313c0029 100644
--- a/drivers/of/of_pci_irq.c
+++ b/drivers/of/of_pci_irq.c
@@ -38,8 +38,8 @@ int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq
38 */ 38 */
39 rc = pci_read_config_byte(pdev, PCI_INTERRUPT_PIN, &pin); 39 rc = pci_read_config_byte(pdev, PCI_INTERRUPT_PIN, &pin);
40 if (rc != 0) 40 if (rc != 0)
41 return rc; 41 goto err;
42 /* No pin, exit */ 42 /* No pin, exit with no error message. */
43 if (pin == 0) 43 if (pin == 0)
44 return -ENODEV; 44 return -ENODEV;
45 45
@@ -53,8 +53,10 @@ int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq
53 ppnode = pci_bus_to_OF_node(pdev->bus); 53 ppnode = pci_bus_to_OF_node(pdev->bus);
54 54
55 /* No node for host bridge ? give up */ 55 /* No node for host bridge ? give up */
56 if (ppnode == NULL) 56 if (ppnode == NULL) {
57 return -EINVAL; 57 rc = -EINVAL;
58 goto err;
59 }
58 } else { 60 } else {
59 /* We found a P2P bridge, check if it has a node */ 61 /* We found a P2P bridge, check if it has a node */
60 ppnode = pci_device_to_OF_node(ppdev); 62 ppnode = pci_device_to_OF_node(ppdev);
@@ -86,7 +88,13 @@ int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq
86 out_irq->args[0] = pin; 88 out_irq->args[0] = pin;
87 laddr[0] = cpu_to_be32((pdev->bus->number << 16) | (pdev->devfn << 8)); 89 laddr[0] = cpu_to_be32((pdev->bus->number << 16) | (pdev->devfn << 8));
88 laddr[1] = laddr[2] = cpu_to_be32(0); 90 laddr[1] = laddr[2] = cpu_to_be32(0);
89 return of_irq_parse_raw(laddr, out_irq); 91 rc = of_irq_parse_raw(laddr, out_irq);
92 if (rc)
93 goto err;
94 return 0;
95err:
96 dev_err(&pdev->dev, "of_irq_parse_pci() failed with rc=%d\n", rc);
97 return rc;
90} 98}
91EXPORT_SYMBOL_GPL(of_irq_parse_pci); 99EXPORT_SYMBOL_GPL(of_irq_parse_pci);
92 100
@@ -105,10 +113,8 @@ int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin)
105 int ret; 113 int ret;
106 114
107 ret = of_irq_parse_pci(dev, &oirq); 115 ret = of_irq_parse_pci(dev, &oirq);
108 if (ret) { 116 if (ret)
109 dev_err(&dev->dev, "of_irq_parse_pci() failed with rc=%d\n", ret);
110 return 0; /* Proper return code 0 == NO_IRQ */ 117 return 0; /* Proper return code 0 == NO_IRQ */
111 }
112 118
113 return irq_create_of_mapping(&oirq); 119 return irq_create_of_mapping(&oirq);
114} 120}