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

Sergey Shtylyov s.shtylyov at omp.ru
Mon Aug 9 13:45:15 PDT 2021


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 at omp.ru>

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

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,



More information about the linux-arm-kernel mailing list