Re: [PATCH 22/22] usb: host: xhci-tegra: deny IRQ0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
> ---
>  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



[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux