linux-samsung-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 4/9] usb: gadget: udc: s3c2410: add IRQ check
       [not found] <47bacc02-4e34-3208-779c-7072a6261782@omp.ru>
@ 2021-08-09 20:35 ` Sergey Shtylyov
  2021-08-10  6:53   ` Krzysztof Kozlowski
  2021-08-12  5:40   ` Felipe Balbi
  0 siblings, 2 replies; 3+ messages in thread
From: Sergey Shtylyov @ 2021-08-09 20:35 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 request_irq() (which takes
*unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original
error code. Stop calling request_irq() with the invalid IRQ #s.

Fixes: 188db4435ac6 ("usb: gadget: s3c: use platform resources")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

---
 drivers/usb/gadget/udc/s3c2410_udc.c |    4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

Index: usb/drivers/usb/gadget/udc/s3c2410_udc.c
===================================================================
--- usb.orig/drivers/usb/gadget/udc/s3c2410_udc.c
+++ usb/drivers/usb/gadget/udc/s3c2410_udc.c
@@ -1784,6 +1784,10 @@ static int s3c2410_udc_probe(struct plat
 	s3c2410_udc_reinit(udc);
 
 	irq_usbd = platform_get_irq(pdev, 0);
+	if (irq_usbd < 0) {
+		retval = irq_usbd;
+		goto err_udc_clk;
+	}
 
 	/* irq setup after old hardware state is cleaned up */
 	retval = request_irq(irq_usbd, s3c2410_udc_irq,

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

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

On 09/08/2021 22:35, Sergey Shtylyov wrote:
> The driver neglects to check the result of platform_get_irq()'s call and
> blithely passes the negative error codes to request_irq() (which takes
> *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original
> error code. Stop calling request_irq() with the invalid IRQ #s.
> 
> Fixes: 188db4435ac6 ("usb: gadget: s3c: use platform resources")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> 
> ---
>  drivers/usb/gadget/udc/s3c2410_udc.c |    4 ++++
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>


Best regards,
Krzysztof

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

* Re: [PATCH v2 4/9] usb: gadget: udc: s3c2410: add IRQ check
  2021-08-09 20:35 ` [PATCH v2 4/9] usb: gadget: udc: s3c2410: add IRQ check Sergey Shtylyov
  2021-08-10  6:53   ` Krzysztof Kozlowski
@ 2021-08-12  5:40   ` Felipe Balbi
  1 sibling, 0 replies; 3+ messages in thread
From: Felipe Balbi @ 2021-08-12  5:40 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 request_irq() (which takes
> *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original
> error code. Stop calling request_irq() with the invalid IRQ #s.
>
> Fixes: 188db4435ac6 ("usb: gadget: s3c: use platform resources")
> 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-12  5:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <47bacc02-4e34-3208-779c-7072a6261782@omp.ru>
2021-08-09 20:35 ` [PATCH v2 4/9] usb: gadget: udc: s3c2410: add IRQ check Sergey Shtylyov
2021-08-10  6:53   ` Krzysztof Kozlowski
2021-08-12  5:40   ` 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).