Skip to content

Commit

Permalink
usb: gadget: udc: at91: add IRQ check
Browse files Browse the repository at this point in the history
[ Upstream commit 50855c3 ]

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: 8b2e766 ("USB: AT91 UDC updates, mostly power management")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Felipe Balbi <balbi@kernel.org>
Link: https://lore.kernel.org/r/6654a224-739a-1a80-12f0-76d920f87b6c@omp.ru
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Sergey Shtylyov authored and gregkh committed Sep 15, 2021
1 parent 0839767 commit a577026
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/usb/gadget/udc/at91_udc.c
Expand Up @@ -1876,7 +1876,9 @@ static int at91udc_probe(struct platform_device *pdev)
clk_disable(udc->iclk);

/* request UDC and maybe VBUS irqs */
udc->udp_irq = platform_get_irq(pdev, 0);
udc->udp_irq = retval = platform_get_irq(pdev, 0);
if (retval < 0)
goto err_unprepare_iclk;
retval = devm_request_irq(dev, udc->udp_irq, at91_udc_irq, 0,
driver_name, udc);
if (retval) {
Expand Down

0 comments on commit a577026

Please sign in to comment.