linux-samsung-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/9] usb: gadget: udc: s3c2410: add IRQ check
       [not found] <717ddd7c-22cd-d82c-e43d-80254718c801@omp.ru>
@ 2021-08-08 20:57 ` Sergey Shtylyov
  2021-08-08 21:01   ` Sergey Shtylyov
  2021-08-09 10:09   ` Felipe Balbi
  0 siblings, 2 replies; 3+ messages in thread
From: Sergey Shtylyov @ 2021-08-08 20:57 UTC (permalink / raw)
  To: linux-usb, Greg Kroah-Hartman, Felipe Balbi
  Cc: Krzysztof Kozlowski, linux-arm-kernel, linux-samsung-soc

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: 8b2e76687b39 ("USB: AT91 UDC updates, mostly power management")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

---
 drivers/usb/gadget/udc/at91_udc.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: usb/drivers/usb/gadget/udc/at91_udc.c
===================================================================
--- usb.orig/drivers/usb/gadget/udc/at91_udc.c
+++ usb/drivers/usb/gadget/udc/at91_udc.c
@@ -1876,7 +1876,9 @@ static int at91udc_probe(struct platform
 	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) {

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 4/9] usb: gadget: udc: s3c2410: add IRQ check
  2021-08-08 20:57 ` [PATCH 4/9] usb: gadget: udc: s3c2410: add IRQ check Sergey Shtylyov
@ 2021-08-08 21:01   ` Sergey Shtylyov
  2021-08-09 10:09   ` Felipe Balbi
  1 sibling, 0 replies; 3+ messages in thread
From: Sergey Shtylyov @ 2021-08-08 21:01 UTC (permalink / raw)
  To: linux-usb, Greg Kroah-Hartman, Felipe Balbi
  Cc: Krzysztof Kozlowski, linux-arm-kernel, linux-samsung-soc

Oops, duplicate patch. Scratch the series, I'm going to restart posting tomorrow... :-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 4/9] usb: gadget: udc: s3c2410: add IRQ check
  2021-08-08 20:57 ` [PATCH 4/9] usb: gadget: udc: s3c2410: add IRQ check Sergey Shtylyov
  2021-08-08 21:01   ` Sergey Shtylyov
@ 2021-08-09 10:09   ` Felipe Balbi
  1 sibling, 0 replies; 3+ messages in thread
From: Felipe Balbi @ 2021-08-09 10:09 UTC (permalink / raw)
  To: Sergey Shtylyov
  Cc: linux-usb, Greg Kroah-Hartman, Krzysztof Kozlowski,
	linux-arm-kernel, linux-samsung-soc


Sergey Shtylyov <s.shtylyov@omp.ru> writes:

> 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: 8b2e76687b39 ("USB: AT91 UDC updates, mostly power management")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

Acked-by: Felipe Balbi <balbi@kernel.org>

-- 
balbi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-09 10:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <717ddd7c-22cd-d82c-e43d-80254718c801@omp.ru>
2021-08-08 20:57 ` [PATCH 4/9] usb: gadget: udc: s3c2410: add IRQ check Sergey Shtylyov
2021-08-08 21:01   ` Sergey Shtylyov
2021-08-09 10:09   ` Felipe Balbi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).