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

From: Linus Walleij
Date: Thu Mar 12 2020 - 18:45:35 EST


On Thu, Mar 12, 2020 at 8:02 PM Bjorn Helgaas <helgaas@xxxxxxxxxx> wrote:

> IIUC, in the link you mentioned, Linus T says that "dev->irq == 0"
> means we don't have a valid IRQ. I think that makes sense, but I'm
> not sure it follows that 0 must be a sensical return value for
> platform_get_irq(). It seems to me that platform_get_irq() ought to
> return either a valid IRQ or an error, and the convention for errors
> is a negative errno.

OK I see your point.

I would be fine of the code is changed from:

if (irq <= 0)
error;

To:

if (irq < 0)
error retrieving IRQ

if (!irq)
error driver requires a valid IRQ

To the driver (this one in specific) the IRQ is expected and
necessary and I think it holds for most PCI hosts.

Yours,
Linus Walleij