diff mbox series

[v2,17/22] usb: host: ohci-st: deny IRQ0

Message ID 20211026173943.6829-18-s.shtylyov@omp.ru (mailing list archive)
State New, archived
Headers show
Series Explicitly deny IRQ0 in the USB host drivers | expand

Commit Message

Sergey Shtylyov Oct. 26, 2021, 5: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: d115837259ad ("usb: host: ohci-st: Add OHCI driver support for ST STB devices")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
Changes in version 2:
- added Alan's ACK.

 drivers/usb/host/ohci-st.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Patrice CHOTARD Oct. 27, 2021, 6:08 a.m. UTC | #1
Hi Sergey

On 10/26/21 7:39 PM, Sergey Shtylyov 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: d115837259ad ("usb: host: ohci-st: Add OHCI driver support for ST STB devices")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> Acked-by: Alan Stern <stern@rowland.harvard.edu>
> ---
> Changes in version 2:
> - added Alan's ACK.
> 
>  drivers/usb/host/ohci-st.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/usb/host/ohci-st.c b/drivers/usb/host/ohci-st.c
> index ac796ccd93ef..b9200071ce6c 100644
> --- a/drivers/usb/host/ohci-st.c
> +++ b/drivers/usb/host/ohci-st.c
> @@ -140,6 +140,8 @@ static int st_ohci_platform_probe(struct platform_device *dev)
>  	irq = platform_get_irq(dev, 0);
>  	if (irq < 0)
>  		return irq;
> +	if (!irq)
> +		return -EINVAL;
>  
>  	res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0);
>  	if (!res_mem) {
> 
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks
Patrice
diff mbox series

Patch

diff --git a/drivers/usb/host/ohci-st.c b/drivers/usb/host/ohci-st.c
index ac796ccd93ef..b9200071ce6c 100644
--- a/drivers/usb/host/ohci-st.c
+++ b/drivers/usb/host/ohci-st.c
@@ -140,6 +140,8 @@  static int st_ohci_platform_probe(struct platform_device *dev)
 	irq = platform_get_irq(dev, 0);
 	if (irq < 0)
 		return irq;
+	if (!irq)
+		return -EINVAL;
 
 	res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0);
 	if (!res_mem) {