[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200502061537.GA2527384@kroah.com>
Date: Sat, 2 May 2020 08:15:37 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Bjorn Helgaas <helgaas@...nel.org>
Cc: Thomas Gleixner <tglx@...utronix.de>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Aman Sharma <amanharitsh123@...il.com>,
linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
Bjorn Helgaas <bhelgaas@...gle.com>
Subject: Re: [PATCH v2 1/2] driver core: platform: Clarify that IRQ 0 is
invalid
On Fri, May 01, 2020 at 05:40:41PM -0500, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@...gle.com>
>
> These interfaces return a negative error number or an IRQ:
>
> platform_get_irq()
> platform_get_irq_optional()
> platform_get_irq_byname()
> platform_get_irq_byname_optional()
>
> The function comments suggest checking for error like this:
>
> irq = platform_get_irq(...);
> if (irq < 0)
> return irq;
>
> which is what most callers (~900 of 1400) do, so it's implicit that IRQ 0
> is invalid. But some callers check for "irq <= 0", and it's not obvious
> from the source that we never return an IRQ 0.
>
> Make this more explicit by updating the comments to say that an IRQ number
> is always non-zero and adding a WARN() if we ever do return zero. If we do
> return IRQ 0, it likely indicates a bug in the arch-specific parts of
> platform_get_irq().
I worry about adding WARN() as there are systems that do panic_on_warn()
and syzbot trips over this as well. I don't think that for this issue
it would be a problem, but what really is this warning about that
someone could do anything with?
Other than that minor thing, this looks good to me, thanks for finally
clearing this up.
greg k-h
Powered by blists - more mailing lists