diff mbox series

[03/22] usb: host: ehci-npcm7xx: deny IRQ0

Message ID 20211018183930.8448-4-s.shtylyov@omp.ru (mailing list archive)
State Superseded
Headers show
Series Explicitly deny IRQ0 in the USB host drivers | expand

Commit Message

Sergey Shtylyov Oct. 18, 2021, 6:39 p.m. UTC
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: df44831ee2dd ("USB host: Add USB ehci support for nuvoton npcm7xx platform")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
 drivers/usb/host/ehci-npcm7xx.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Avi Fishman Oct. 19, 2021, 7:11 a.m. UTC | #1
On Mon, Oct 18, 2021 at 9:39 PM Sergey Shtylyov <s.shtylyov@omp.ru> 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: df44831ee2dd ("USB host: Add USB ehci support for nuvoton npcm7xx platform")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> ---
>  drivers/usb/host/ehci-npcm7xx.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/usb/host/ehci-npcm7xx.c b/drivers/usb/host/ehci-npcm7xx.c
> index 6b5a7a873e01..aff3d906ced5 100644
> --- a/drivers/usb/host/ehci-npcm7xx.c
> +++ b/drivers/usb/host/ehci-npcm7xx.c
> @@ -114,6 +114,10 @@ static int npcm7xx_ehci_hcd_drv_probe(struct platform_device *pdev)
>                 retval = irq;
>                 goto fail;
>         }
> +       if (!irq) {
> +               retval = -EINVAL;
> +               goto fail;
> +       }
>
>         /*
>          * Right now device-tree probed devices don't get dma_mask set.
> --
> 2.26.3
>
Reviewed-by: Avi Fishman <avifishman70@gmail.com>

--
Regards,
Avi
diff mbox series

Patch

diff --git a/drivers/usb/host/ehci-npcm7xx.c b/drivers/usb/host/ehci-npcm7xx.c
index 6b5a7a873e01..aff3d906ced5 100644
--- a/drivers/usb/host/ehci-npcm7xx.c
+++ b/drivers/usb/host/ehci-npcm7xx.c
@@ -114,6 +114,10 @@  static int npcm7xx_ehci_hcd_drv_probe(struct platform_device *pdev)
 		retval = irq;
 		goto fail;
 	}
+	if (!irq) {
+		retval = -EINVAL;
+		goto fail;
+	}
 
 	/*
 	 * Right now device-tree probed devices don't get dma_mask set.