Skip to contentSkip to conversation

PCI: exynos: Fix platform_get_irq() error handling

PATCH In review Fabio Estevam 5 participants 14 messages Aug 31, 2017 – Sep 5, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/10 PCI: exynos: Fix platform_get_irq() error handling

platform_get_irq() returns a negative number on failure, so adjust the logic to detect such condition and propagate the real error value on failure.

---
 drivers/pci/dwc/pci-exynos.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/pci/dwc/pci-exynos.c +4 -4
index f77f872..5596fde 100644
@@ -607,9 +607,9 @@ static int __init exynos_add_pcie_port(struct exynos_pcie *ep,
 	int ret;
 
 	pp->irq = platform_get_irq(pdev, 1);
-	if (!pp->irq) {
+	if (pp->irq < 0) {
 		dev_err(dev, "failed to get irq\n");
-		return -ENODEV;
+		return pp->irq;
 	}
 	ret = devm_request_irq(dev, pp->irq, exynos_pcie_irq_handler,
 				IRQF_SHARED, "exynos-pcie", ep);
@@ -620,9 +620,9 @@ static int __init exynos_add_pcie_port(struct exynos_pcie *ep,
 
 	if (IS_ENABLED(CONFIG_PCI_MSI)) {
 		pp->msi_irq = platform_get_irq(pdev, 0);
-		if (!pp->msi_irq) {
+		if (pp->msi_irq < 0) {
 			dev_err(dev, "failed to get msi irq\n");
-			return -ENODEV;
+			return pp->msi_irq;
 		}
 
 		ret = devm_request_irq(dev, pp->msi_irq,
Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/10 PCI: dra7xx: Fix platform_get_irq() error handling

When platform_get_irq() fails we should propagate the real error value instead of always returning -EINVAL.

Cc Kishon Vijay Abraham I <[email protected]>
---
 drivers/pci/dwc/pci-dra7xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/dwc/pci-dra7xx.c +1 -1
index e0dd98d..1e2aaed 100644
@@ -450,7 +450,7 @@ static int __init dra7xx_add_pcie_port(struct dra7xx_pcie *dra7xx,
 	pp->irq = platform_get_irq(pdev, 1);
 	if (pp->irq < 0) {
 		dev_err(dev, "missing IRQ resource\n");
-		return -EINVAL;
+		return pp->irq;
 	}
 
 	ret = devm_request_irq(dev, pp->irq, dra7xx_pcie_msi_irq_handler,
Signature · 1 line
2.7.4
Acked-by on v1 2/10
#2 lore raw

Re: [PATCH 02/10] PCI: dra7xx: Fix platform_get_irq() error handling

Quoted 5 lines · Fabio Estevam

When platform_get_irq() fails we should propagate the real error value instead of always returning -EINVAL.

Cc Kishon Vijay Abraham I <[email protected]>
Quoted 18 lines
---
 drivers/pci/dwc/pci-dra7xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/dwc/pci-dra7xx.c +1 -1
index e0dd98d..1e2aaed 100644
@@ -450,7 +450,7 @@ static int __init dra7xx_add_pcie_port(struct dra7xx_pcie *dra7xx,
 	pp->irq = platform_get_irq(pdev, 1);
 	if (pp->irq < 0) {
 		dev_err(dev, "missing IRQ resource\n");
-		return -EINVAL;
+		return pp->irq;
 	}
 
 	ret = devm_request_irq(dev, pp->irq, dra7xx_pcie_msi_irq_handler,
#3 lore raw

PATCH 3/10 PCI: armada8k: Fix platform_get_irq() error handling

In reply to Fabio Estevam

platform_get_irq() returns a negative number on failure, so adjust the logic to detect such condition and propagate the real error value on failure.

Cc Thomas Petazzoni <[email protected]>
---
 drivers/pci/dwc/pcie-armada8k.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/dwc/pcie-armada8k.c +2 -2
index f47e1a0..370d057 100644
@@ -178,9 +178,9 @@ static int armada8k_add_pcie_port(struct armada8k_pcie *pcie,
 	pp->ops = &armada8k_pcie_host_ops;
 
 	pp->irq = platform_get_irq(pdev, 0);
-	if (!pp->irq) {
+	if (pp->irq < 0) {
 		dev_err(dev, "failed to get irq for port\n");
-		return -ENODEV;
+		return pp->irq;
 	}
 
 	ret = devm_request_irq(dev, pp->irq, armada8k_pcie_irq_handler,
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/10 PCI: artpec6: Fix platform_get_irq() error handling

In reply to Fabio Estevam

platform_get_irq() returns a negative number on failure, so adjust the logic to detect such condition and propagate the real error value on failure.

---
 drivers/pci/dwc/pcie-artpec6.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/dwc/pcie-artpec6.c +2 -2
index 5d81f1d..83d6ee0 100644
@@ -209,9 +209,9 @@ static int artpec6_add_pcie_port(struct artpec6_pcie *artpec6_pcie,
 
 	if (IS_ENABLED(CONFIG_PCI_MSI)) {
 		pp->msi_irq = platform_get_irq_byname(pdev, "msi");
-		if (pp->msi_irq <= 0) {
+		if (pp->msi_irq < 0) {
 			dev_err(dev, "failed to get MSI irq\n");
-			return -ENODEV;
+			return pp->msi_irq;
 		}
 
 		ret = devm_request_irq(dev, pp->msi_irq,
Signature · 1 line
2.7.4
Acked-by on v1 4/10
#5 lore raw

Re: [PATCH 04/10] PCI: artpec6: Fix platform_get_irq() error handling

Quoted 27 lines · Fabio Estevam

platform_get_irq() returns a negative number on failure, so adjust the logic to detect such condition and propagate the real error value on failure.

---
 drivers/pci/dwc/pcie-artpec6.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/dwc/pcie-artpec6.c +2 -2
index 5d81f1d..83d6ee0 100644
@@ -209,9 +209,9 @@ static int artpec6_add_pcie_port(struct artpec6_pcie *artpec6_pcie,
 
 	if (IS_ENABLED(CONFIG_PCI_MSI)) {
 		pp->msi_irq = platform_get_irq_byname(pdev, "msi");
-		if (pp->msi_irq <= 0) {
+		if (pp->msi_irq < 0) {
 			dev_err(dev, "failed to get MSI irq\n");
-			return -ENODEV;
+			return pp->msi_irq;
 		}
 
 		ret = devm_request_irq(dev, pp->msi_irq,
#6 lore raw

PATCH 5/10 PCI: spear13xx: Fix platform_get_irq() error handling

In reply to Fabio Estevam

platform_get_irq() returns a negative number on failure, so adjust the logic to detect such condition and propagate the real error value on failure.

---
 drivers/pci/dwc/pcie-spear13xx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/dwc/pcie-spear13xx.c +2 -2
index 52000bc..709189d 100644
@@ -201,9 +201,9 @@ static int spear13xx_add_pcie_port(struct spear13xx_pcie *spear13xx_pcie,
 	int ret;
 
 	pp->irq = platform_get_irq(pdev, 0);
-	if (!pp->irq) {
+	if (pp->irq < 0) {
 		dev_err(dev, "failed to get irq\n");
-		return -ENODEV;
+		return pp->irq;
 	}
 	ret = devm_request_irq(dev, pp->irq, spear13xx_pcie_irq_handler,
 			       IRQF_SHARED | IRQF_NO_THREAD,
Signature · 1 line
2.7.4
#7 lore raw

PATCH 6/10 PCI: xgene-msi: Fix platform_get_irq() error handling

In reply to Fabio Estevam

When platform_get_irq() fails we should propagate the real error value instead of always returning -EINVAL.

---
 drivers/pci/host/pci-xgene-msi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/host/pci-xgene-msi.c +1 -1
index f1b633b..1f42a20 100644
@@ -489,7 +489,7 @@ static int xgene_msi_probe(struct platform_device *pdev)
 		if (virt_msir < 0) {
 			dev_err(&pdev->dev, "Cannot translate IRQ index %d\n",
 				irq_index);
-			rc = -EINVAL;
+			rc = virt_msir;
 			goto error;
 		}
 		xgene_msi->msi_groups[irq_index].gic_irq = virt_msir;
Signature · 1 line
2.7.4
#8 lore raw

PATCH 7/10 PCI: altera-msi: Fix platform_get_irq() error handling

In reply to Fabio Estevam

platform_get_irq() returns a negative number on failure, so adjust the logic to detect such condition and propagate the real error value on failure.

---
 drivers/pci/host/pcie-altera-msi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/host/pcie-altera-msi.c +2 -2
index 2864030..d8141f4 100644
@@ -265,9 +265,9 @@ static int altera_msi_probe(struct platform_device *pdev)
 		return ret;
 
 	msi->irq = platform_get_irq(pdev, 0);
-	if (msi->irq <= 0) {
+	if (msi->irq < 0) {
 		dev_err(&pdev->dev, "failed to map IRQ: %d\n", msi->irq);
-		ret = -ENODEV;
+		ret = msi->irq;
 		goto err;
 	}
 
Signature · 1 line
2.7.4
#9 lore raw

PATCH 8/10 PCI: altera: Fix platform_get_irq() error handling

In reply to Fabio Estevam

platform_get_irq() returns a negative number on failure, so adjust the logic to detect such condition and propagate the real error value on failure.

---
 drivers/pci/host/pcie-altera.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/host/pcie-altera.c +2 -2
index 6fced59..b468b8ccc 100644
@@ -558,9 +558,9 @@ static int altera_pcie_parse_dt(struct altera_pcie *pcie)
 
 	/* setup IRQ */
 	pcie->irq = platform_get_irq(pdev, 0);
-	if (pcie->irq <= 0) {
+	if (pcie->irq < 0) {
 		dev_err(dev, "failed to get IRQ: %d\n", pcie->irq);
-		return -EINVAL;
+		return pcie->irq;
 	}
 
 	irq_set_chained_handler_and_data(pcie->irq, altera_pcie_isr, pcie);
Signature · 1 line
2.7.4
#10 lore raw

PATCH 9/10 PCI: rockchip: Fix platform_get_irq() error handling

In reply to Fabio Estevam

When platform_get_irq() fails we should propagate the real error value instead of always returning -EINVAL

---
 drivers/pci/host/pcie-rockchip.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pci/host/pcie-rockchip.c +3 -3
index 56c2423..d205381 100644
@@ -962,7 +962,7 @@ static int rockchip_pcie_setup_irq(struct rockchip_pcie *rockchip)
 	irq = platform_get_irq_byname(pdev, "sys");
 	if (irq < 0) {
 		dev_err(dev, "missing sys IRQ resource\n");
-		return -EINVAL;
+		return irq;
 	}
 
 	err = devm_request_irq(dev, irq, rockchip_pcie_subsys_irq_handler,
@@ -975,7 +975,7 @@ static int rockchip_pcie_setup_irq(struct rockchip_pcie *rockchip)
 	irq = platform_get_irq_byname(pdev, "legacy");
 	if (irq < 0) {
 		dev_err(dev, "missing legacy IRQ resource\n");
-		return -EINVAL;
+		return irq;
 	}
 
 	irq_set_chained_handler_and_data(irq,
@@ -985,7 +985,7 @@ static int rockchip_pcie_setup_irq(struct rockchip_pcie *rockchip)
 	irq = platform_get_irq_byname(pdev, "client");
 	if (irq < 0) {
 		dev_err(dev, "missing client IRQ resource\n");
-		return -EINVAL;
+		return irq;
 	}
 
 	err = devm_request_irq(dev, irq, rockchip_pcie_client_irq_handler,
Signature · 1 line
2.7.4
#11 lore raw

PATCH 10/10 PCI: xilinx-nwl: Fix platform_get_irq() error handling

In reply to Fabio Estevam

When platform_get_irq() fails we should propagate the real error value instead of always returning -EINVAL.

---
 drivers/pci/host/pcie-xilinx-nwl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/host/pcie-xilinx-nwl.c +1 -1
index 573847f..65dea98 100644
@@ -812,7 +812,7 @@ static int nwl_pcie_parse_dt(struct nwl_pcie *pcie,
 	pcie->irq_intx = platform_get_irq_byname(pdev, "intx");
 	if (pcie->irq_intx < 0) {
 		dev_err(dev, "failed to get intx IRQ %d\n", pcie->irq_intx);
-		return -EINVAL;
+		return pcie->irq_intx;
 	}
 
 	irq_set_chained_handler_and_data(pcie->irq_intx,
Signature · 1 line
2.7.4
Acked-by on v1 1/10
#12 lore raw
In reply to Fabio Estevam

(CC'ed Joao Pinto)

Quoted 8 lines · Fabio Estevam

platform_get_irq() returns a negative number on failure, so adjust the logic to detect such condition and propagate the real error value on failure.

Best regards,
Jingoo Han

Quoted 36 lines
---
 drivers/pci/dwc/pci-exynos.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/pci/dwc/pci-exynos.c +2 -2
index f77f872..5596fde 100644
@@ -607,9 +607,9 @@ static int __init exynos_add_pcie_port(struct
 exynos_pcie *ep,
 	int ret;
 
 	pp->irq = platform_get_irq(pdev, 1);
-	if (!pp->irq) {
+	if (pp->irq < 0) {
 		dev_err(dev, "failed to get irq\n");
-		return -ENODEV;
+		return pp->irq;
 	}
 	ret = devm_request_irq(dev, pp->irq, exynos_pcie_irq_handler,
drivers/pci/dwc/pci-exynos.c +2 -2
 				IRQF_SHARED, "exynos-pcie", ep);
@@ -620,9 +620,9 @@ static int __init exynos_add_pcie_port(struct
 exynos_pcie *ep,
 
 	if (IS_ENABLED(CONFIG_PCI_MSI)) {
 		pp->msi_irq = platform_get_irq(pdev, 0);
-		if (!pp->msi_irq) {
+		if (pp->msi_irq < 0) {
 			dev_err(dev, "failed to get msi irq\n");
-			return -ENODEV;
+			return pp->msi_irq;
 		}
 

ret = devm_request_irq(dev, pp->msi_irq,
--
2.7.4

#13 lore raw
In reply to Fabio Estevam
Quoted 7 lines · Fabio Estevam

platform_get_irq() returns a negative number on failure, so adjust the logic to detect such condition and propagate the real error value on failure.

Thanks, Fabio. I applied all these on their respective branches for v4.14, with the acks received so far.

Quoted 35 lines
---
 drivers/pci/dwc/pci-exynos.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/pci/dwc/pci-exynos.c +4 -4
index f77f872..5596fde 100644
@@ -607,9 +607,9 @@ static int __init exynos_add_pcie_port(struct exynos_pcie *ep,
 	int ret;
 
 	pp->irq = platform_get_irq(pdev, 1);
-	if (!pp->irq) {
+	if (pp->irq < 0) {
 		dev_err(dev, "failed to get irq\n");
-		return -ENODEV;
+		return pp->irq;
 	}
 	ret = devm_request_irq(dev, pp->irq, exynos_pcie_irq_handler,
 				IRQF_SHARED, "exynos-pcie", ep);
@@ -620,9 +620,9 @@ static int __init exynos_add_pcie_port(struct exynos_pcie *ep,
 
 	if (IS_ENABLED(CONFIG_PCI_MSI)) {
 		pp->msi_irq = platform_get_irq(pdev, 0);
-		if (!pp->msi_irq) {
+		if (pp->msi_irq < 0) {
 			dev_err(dev, "failed to get msi irq\n");
-			return -ENODEV;
+			return pp->msi_irq;
 		}
 
 		ret = devm_request_irq(dev, pp->msi_irq,
Signature · 1 line
2.7.4