diff mbox series

[11/22] usb: host: ohci-at91: deny IRQ0

Message ID 20211018183930.8448-12-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: 60bbfc84b6d9 ("USB OHCI controller support for PNX4008")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
 drivers/usb/host/ohci-nxp.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Alexander Dahl Oct. 19, 2021, 11:15 a.m. UTC | #1
Hello Sergey,

Am Mon, Oct 18, 2021 at 09:39:19PM +0300 schrieb 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: 60bbfc84b6d9 ("USB OHCI controller support for PNX4008")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> ---
>  drivers/usb/host/ohci-nxp.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c
> index 85878e8ad331..afb9c2fc85c3 100644
> --- a/drivers/usb/host/ohci-nxp.c
> +++ b/drivers/usb/host/ohci-nxp.c
> @@ -215,6 +215,10 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
>  		ret = -ENXIO;
>  		goto fail_resource;
>  	}
> +	if (!irq) {
> +		ret = -EINVAL;
> +		goto fail_resource;
> +	}
>  
>  	ohci_nxp_start_hc();
>  	platform_set_drvdata(pdev, hcd);

Subject refers to at91 while content is about nxp.

Greets
Alex
Sergey Shtylyov Oct. 19, 2021, 4:51 p.m. UTC | #2
On 10/19/21 2:15 PM, Alexander Dahl 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: 60bbfc84b6d9 ("USB OHCI controller support for PNX4008")
>> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
>> ---
>>  drivers/usb/host/ohci-nxp.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c
>> index 85878e8ad331..afb9c2fc85c3 100644
>> --- a/drivers/usb/host/ohci-nxp.c
>> +++ b/drivers/usb/host/ohci-nxp.c
>> @@ -215,6 +215,10 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
>>  		ret = -ENXIO;
>>  		goto fail_resource;
>>  	}
>> +	if (!irq) {
>> +		ret = -EINVAL;
>> +		goto fail_resource;
>> +	}
>>  
>>  	ohci_nxp_start_hc();
>>  	platform_set_drvdata(pdev, hcd);
> 
> Subject refers to at91 while content is about nxp.

   Oops, sorry! :-<
   That's what you get when you send 22 patches fixing the same issue... :-)

> Greets
> Alex

MBR, Sergey
diff mbox series

Patch

diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c
index 85878e8ad331..afb9c2fc85c3 100644
--- a/drivers/usb/host/ohci-nxp.c
+++ b/drivers/usb/host/ohci-nxp.c
@@ -215,6 +215,10 @@  static int ohci_hcd_nxp_probe(struct platform_device *pdev)
 		ret = -ENXIO;
 		goto fail_resource;
 	}
+	if (!irq) {
+		ret = -EINVAL;
+		goto fail_resource;
+	}
 
 	ohci_nxp_start_hc();
 	platform_set_drvdata(pdev, hcd);