public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
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: Thu, 21 Oct 2021 12:09:56 +0300	[thread overview]
Message-ID: <415d1410-5b5f-3de4-1973-998528481c0f@gmail.com> (raw)
In-Reply-To: <20211018183930.8448-23-s.shtylyov@omp.ru>

18.10.2021 21:39, Sergey Shtylyov пишет:
> 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]. Should be better to fix [2] and return -EINVAL.

[1]
https://elixir.bootlin.com/linux/v5.15-rc6/source/drivers/base/platform.c#L254

[2]
https://elixir.bootlin.com/linux/v5.15-rc6/source/drivers/base/platform.c#L226

  reply	other threads:[~2021-10-21  9:10 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 [this message]
2021-10-26 18:24     ` Sergey Shtylyov
2021-10-27 11:13       ` Dmitry Osipenko
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=415d1410-5b5f-3de4-1973-998528481c0f@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