Re: [PATCH 1/5] pci: handled return value of platform_get_irq correctly

From: Linus Walleij
Date: Thu Mar 12 2020 - 10:08:15 EST


On Wed, Mar 11, 2020 at 8:19 PM Aman Sharma <amanharitsh123@xxxxxxxxx> wrote:

> Signed-off-by: Aman Sharma <amanharitsh123@xxxxxxxxx>
> ---
> drivers/pci/controller/pci-v3-semi.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/controller/pci-v3-semi.c b/drivers/pci/controller/pci-v3-semi.c
> index bd05221f5a22..a5bf945d2eda 100644
> --- a/drivers/pci/controller/pci-v3-semi.c
> +++ b/drivers/pci/controller/pci-v3-semi.c
> @@ -777,9 +777,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) {

Have you considered:
https://lwn.net/Articles/470820/

TL;DR Linus (both of them) are not with you on this.

And that is why the code is written like this.

Do you really have a platform that could return 0 as IRQ
here? In that case, can we fix it?

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

That's OK with me.

Yours,
Linus Walleij