diff mbox series

[v2,4/9] usb: gadget: udc: s3c2410: add IRQ check

Message ID bd69b22c-b484-5a1f-c798-78d4b78405f2@omp.ru
State New
Headers show
Series None | expand

Commit Message

Sergey Shtylyov Aug. 9, 2021, 8:35 p.m. UTC
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(-)

Comments

Krzysztof Kozlowski Aug. 10, 2021, 6:53 a.m. UTC | #1
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
Felipe Balbi Aug. 12, 2021, 5:40 a.m. UTC | #2
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
diff mbox series

Patch

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,