diff mbox

[2/5] PCI: v3-semi: Fix platform_get_irq() error handling

Message ID 1508018851-9272-2-git-send-email-festevam@gmail.com (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show

Commit Message

Fabio Estevam Oct. 14, 2017, 10:07 p.m. UTC
When platform_get_irq() fails we should propagate the real error value
instead of always returning -ENODEV.

Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 drivers/pci/host/pci-v3-semi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Linus Walleij Oct. 14, 2017, 10:26 p.m. UTC | #1
On Sun, Oct 15, 2017 at 12:07 AM, Fabio Estevam <festevam@gmail.com> wrote:

> When platform_get_irq() fails we should propagate the real error value
> instead of always returning -ENODEV.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Fabio Estevam <festevam@gmail.com>

OK

>         irq = platform_get_irq(pdev, 0);
> -       if (irq <= 0) {
> +       if (irq < 0) {

So 0 is NO_IRQ and not valid these days. See:
https://lwn.net/Articles/470820/

>                 dev_err(dev, "unable to obtain PCIv3 error IRQ\n");
> -               return -ENODEV;
> +               return irq;

But this is right, if irq < 0.

Yours,
Linus Walleij
diff mbox

Patch

diff --git a/drivers/pci/host/pci-v3-semi.c b/drivers/pci/host/pci-v3-semi.c
index a544d72..01017af 100644
--- a/drivers/pci/host/pci-v3-semi.c
+++ b/drivers/pci/host/pci-v3-semi.c
@@ -806,9 +806,9 @@  static int v3_pci_probe(struct platform_device *pdev)
 
 	/* Get and request error IRQ resource */
 	irq = platform_get_irq(pdev, 0);
-	if (irq <= 0) {
+	if (irq < 0) {
 		dev_err(dev, "unable to obtain PCIv3 error IRQ\n");
-		return -ENODEV;
+		return irq;
 	}
 	ret = devm_request_irq(dev, irq, v3_irq, 0,
 			"PCIv3 error", v3);