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 |
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
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,
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(+)