diff mbox series

[v2,6/9] usb: misc: brcmstb-usb-pinmap: add IRQ check

Message ID 806d0b1a-365b-93d9-3fc1-922105ca5e61@omp.ru
State New
Headers show
Series Stop calling request_irq(), etc. with invalid IRQs in the USB drivers | expand

Commit Message

Sergey Shtylyov Aug. 9, 2021, 8:45 p.m. UTC
The driver neglects to check the result of platform_get_irq()'s call and
blithely passes the negative error codes to devm_request_irq() (which takes
*unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original
error code.  Stop calling devm_request_irq() with the invalid IRQ #s.

Fixes: 517c4c44b323 ("usb: Add driver to allow any GPIO to be used for 7211 USB signals")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

---
 drivers/usb/misc/brcmstb-usb-pinmap.c |    2 ++
 1 file changed, 2 insertions(+)

Comments

Florian Fainelli Aug. 10, 2021, 9:51 a.m. UTC | #1
On 8/9/2021 1:45 PM, Sergey Shtylyov wrote:
> The driver neglects to check the result of platform_get_irq()'s call and

> blithely passes the negative error codes to devm_request_irq() (which takes

> *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original

> error code.  Stop calling devm_request_irq() with the invalid IRQ #s.

> 

> Fixes: 517c4c44b323 ("usb: Add driver to allow any GPIO to be used for 7211 USB signals")

> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>


Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

--
Florian
diff mbox series

Patch

Index: usb/drivers/usb/misc/brcmstb-usb-pinmap.c
===================================================================
--- usb.orig/drivers/usb/misc/brcmstb-usb-pinmap.c
+++ usb/drivers/usb/misc/brcmstb-usb-pinmap.c
@@ -293,6 +293,8 @@  static int __init brcmstb_usb_pinmap_pro
 
 		/* Enable interrupt for out pins */
 		irq = platform_get_irq(pdev, 0);
+		if (irq < 0)
+			return irq;
 		err = devm_request_irq(&pdev->dev, irq,
 				       brcmstb_usb_pinmap_ovr_isr,
 				       IRQF_TRIGGER_RISING,