From: Dmitry Osipenko <digetx@gmail.com>
To: Sergey Shtylyov <s.shtylyov@omp.ru>,
linux-usb@vger.kernel.org, Alan Stern <stern@rowland.harvard.edu>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Thierry Reding <thierry.reding@gmail.com>,
Jonathan Hunter <jonathanh@nvidia.com>,
linux-tegra@vger.kernel.org
Subject: Re: [PATCH 22/22] usb: host: xhci-tegra: deny IRQ0
Date: Wed, 27 Oct 2021 14:13:41 +0300 [thread overview]
Message-ID: <424502be-baab-4c89-a39b-b921a4e2bd37@gmail.com> (raw)
In-Reply-To: <bde8811f-806e-1845-9a17-25227ecc02e9@omp.ru>
26.10.2021 21:24, Sergey Shtylyov пишет:
> Hello!
>
> On 10/21/21 12:09 PM, Dmitry Osipenko wrote:
> [...]
>>> If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
>>> the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
>>> at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
>>>
>>> Fixes: e84fce0f8837 ("usb: xhci: Add NVIDIA Tegra XUSB controller driver")
>>> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
>>> ---
>>> drivers/usb/host/xhci-tegra.c | 2 ++
>>> 1 file changed, 2 insertions(+)
>>>
>>> diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c
>>> index 1bf494b649bd..7151b1d4f876 100644
>>> --- a/drivers/usb/host/xhci-tegra.c
>>> +++ b/drivers/usb/host/xhci-tegra.c
>>> @@ -1439,6 +1439,8 @@ static int tegra_xusb_probe(struct platform_device *pdev)
>>> tegra->xhci_irq = platform_get_irq(pdev, 0);
>>> if (tegra->xhci_irq < 0)
>>> return tegra->xhci_irq;
>>> + if (!tegra->xhci_irq)
>>> + return -ENIVAL;
>>>
>>> tegra->mbox_irq = platform_get_irq(pdev, 1);
>>> if (tegra->mbox_irq < 0)
>>>
>>
>> platform_get_irq() never returns zero in accordance to [1], but I see
>> that it can return it [2].
>
> Not only that, it also can be returned thru the normal path (from an IRQ descriptor).
> I'm not sure whether 0 means an IRQ0 returned from acpi_dev_gpio_irq_get(), looks like yes...
>
>> Should be better to fix [2] and return -EINVAL.
>
> No, we have WARN() before returning IRQ0 -- if we're going to finally declare IRQ0 invalid,
> it should be done after this check.
Warning is already explicitly saying that IRQ0 is invalid, hence IRQ0
*is* declared invalid. Either doc comment or function itself is wrong,
both are bad.
If function is wrong, then you're fixing symptom instead of fixing the
root of the problem.
next prev parent reply other threads:[~2021-10-27 11:13 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-18 18:39 [PATCH 00/22] Explicitly deny IRQ0 in the USB host drivers Sergey Shtylyov
2021-10-18 18:39 ` [PATCH 01/22] usb: host: ehci-exynos: deny IRQ0 Sergey Shtylyov
2021-10-18 18:39 ` [PATCH 02/22] usb: host: ehci-mv: " Sergey Shtylyov
2021-10-18 18:39 ` [PATCH 03/22] usb: host: ehci-npcm7xx: " Sergey Shtylyov
2021-10-19 7:11 ` Avi Fishman
2021-10-18 18:39 ` [PATCH 04/22] usb: host: ehci-omap: " Sergey Shtylyov
2021-10-21 6:28 ` kernel test robot
2021-10-18 18:39 ` [PATCH 05/22] usb: host: ehci-platform: " Sergey Shtylyov
2021-10-18 18:39 ` [PATCH 06/22] usb: host: ehci-spear: " Sergey Shtylyov
2021-10-18 18:39 ` [PATCH 07/22] usb: host: ehci-st: " Sergey Shtylyov
2021-10-18 18:39 ` [PATCH 08/22] usb: host: ohci-at91: " Sergey Shtylyov
2021-10-18 18:39 ` [PATCH 09/22] usb: host: ohci-da8xx: " Sergey Shtylyov
2021-10-18 18:39 ` [PATCH 10/22] usb: host: ohci-exynos: " Sergey Shtylyov
2021-10-18 18:39 ` [PATCH 11/22] usb: host: ohci-at91: " Sergey Shtylyov
2021-10-19 11:15 ` Alexander Dahl
2021-10-19 16:51 ` Sergey Shtylyov
2021-10-18 18:39 ` [PATCH 12/22] usb: host: ohci-omap: " Sergey Shtylyov
2021-10-18 18:39 ` [PATCH 13/22] usb: host: ohci-platform: " Sergey Shtylyov
2021-10-18 18:39 ` [PATCH 14/22] usb: host: ohci-pxa27x: " Sergey Shtylyov
2021-10-18 18:39 ` [PATCH 15/22] usb: host: ohci-sm501: " Sergey Shtylyov
2021-10-18 18:39 ` [PATCH 16/22] usb: host: ohci-spear: " Sergey Shtylyov
2021-10-18 18:39 ` [PATCH 17/22] usb: host: ohci-st: " Sergey Shtylyov
2021-10-18 18:39 ` [PATCH 18/22] usb: host: ohci-tmio: " Sergey Shtylyov
2021-10-18 18:39 ` [PATCH 19/22] usb: host: xhci-histb: " Sergey Shtylyov
2021-10-18 18:39 ` [PATCH 20/22] usb: host: xhci-mtk: " Sergey Shtylyov
2021-10-20 7:32 ` Chunfeng Yun
2021-10-18 18:39 ` [PATCH 21/22] usb: host: xhci-plat: " Sergey Shtylyov
2021-10-18 18:39 ` [PATCH 22/22] usb: host: xhci-tegra: " Sergey Shtylyov
2021-10-21 9:09 ` Dmitry Osipenko
2021-10-26 18:24 ` Sergey Shtylyov
2021-10-27 11:13 ` Dmitry Osipenko [this message]
2021-10-19 1:35 ` [PATCH 00/22] Explicitly deny IRQ0 in the USB host drivers Alan Stern
2021-10-19 5:41 ` Greg Kroah-Hartman
2021-10-19 7:31 ` Greg Kroah-Hartman
2021-10-19 18:28 ` Sergey Shtylyov
2021-10-19 18:35 ` Alan Stern
2021-10-19 18:46 ` Sergey Shtylyov
2021-10-20 16:06 ` Sergey Shtylyov
2021-10-19 18:18 ` Sergey Shtylyov
2021-10-20 16:16 ` Greg Kroah-Hartman
2021-10-20 18:50 ` Sergey Shtylyov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=424502be-baab-4c89-a39b-b921a4e2bd37@gmail.com \
--to=digetx@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jonathanh@nvidia.com \
--cc=linux-tegra@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=s.shtylyov@omp.ru \
--cc=stern@rowland.harvard.edu \
--cc=thierry.reding@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox