linux-amlogic.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/9] usb: dwc3: meson-g12a: add IRQ check
       [not found] <717ddd7c-22cd-d82c-e43d-80254718c801@omp.ru>
@ 2021-08-08 20:37 ` Sergey Shtylyov
  2021-08-08 20:50   ` Martin Blumenstingl
  2021-08-09 10:08   ` Felipe Balbi
  0 siblings, 2 replies; 3+ messages in thread
From: Sergey Shtylyov @ 2021-08-08 20:37 UTC (permalink / raw)
  To: linux-usb, Greg Kroah-Hartman, Felipe Balbi
  Cc: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	linux-arm-kernel, linux-amlogic

The driver neglects to check the result of platform_get_irq()'s call and
blithely passes the negative error codes to devm_request_threaded_irq()
(which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding
an original error code. Stop calling devm_request_threaded_irq() with the
invalid IRQ #s.

Fixes: f90db10779ad ("usb: dwc3: meson-g12a: Add support for IRQ based OTG switching")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

---
 drivers/usb/dwc3/dwc3-meson-g12a.c |    2 ++
 1 file changed, 2 insertions(+)

Index: usb/drivers/usb/dwc3/dwc3-meson-g12a.c
===================================================================
--- usb.orig/drivers/usb/dwc3/dwc3-meson-g12a.c
+++ usb/drivers/usb/dwc3/dwc3-meson-g12a.c
@@ -598,6 +598,8 @@ static int dwc3_meson_g12a_otg_init(stru
 				   USB_R5_ID_DIG_IRQ, 0);
 
 		irq = platform_get_irq(pdev, 0);
+		if (irq < 0)
+			return irq;
 		ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
 						dwc3_meson_g12a_irq_thread,
 						IRQF_ONESHOT, pdev->name, priv);

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH 1/9] usb: dwc3: meson-g12a: add IRQ check
  2021-08-08 20:37 ` [PATCH 1/9] usb: dwc3: meson-g12a: add IRQ check Sergey Shtylyov
@ 2021-08-08 20:50   ` Martin Blumenstingl
  2021-08-09 10:08   ` Felipe Balbi
  1 sibling, 0 replies; 3+ messages in thread
From: Martin Blumenstingl @ 2021-08-08 20:50 UTC (permalink / raw)
  To: Sergey Shtylyov
  Cc: linux-usb, Greg Kroah-Hartman, Felipe Balbi, Neil Armstrong,
	Kevin Hilman, Jerome Brunet, linux-arm-kernel, linux-amlogic

Hi Sergey,

On Sun, Aug 8, 2021 at 10:37 PM Sergey Shtylyov <s.shtylyov@omp.ru> wrote:
>
> The driver neglects to check the result of platform_get_irq()'s call and
> blithely passes the negative error codes to devm_request_threaded_irq()
> (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding
> an original error code. Stop calling devm_request_threaded_irq() with the
> invalid IRQ #s.
>
> Fixes: f90db10779ad ("usb: dwc3: meson-g12a: Add support for IRQ based OTG switching")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Thanks for spotting and fixing this issue!
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH 1/9] usb: dwc3: meson-g12a: add IRQ check
  2021-08-08 20:37 ` [PATCH 1/9] usb: dwc3: meson-g12a: add IRQ check Sergey Shtylyov
  2021-08-08 20:50   ` Martin Blumenstingl
@ 2021-08-09 10:08   ` Felipe Balbi
  1 sibling, 0 replies; 3+ messages in thread
From: Felipe Balbi @ 2021-08-09 10:08 UTC (permalink / raw)
  To: Sergey Shtylyov
  Cc: linux-usb, Greg Kroah-Hartman, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, linux-arm-kernel,
	linux-amlogic


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_threaded_irq()
> (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding
> an original error code. Stop calling devm_request_threaded_irq() with the
> invalid IRQ #s.
>
> Fixes: f90db10779ad ("usb: dwc3: meson-g12a: Add support for IRQ based OTG switching")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

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


-- 
balbi

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ 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:37 ` [PATCH 1/9] usb: dwc3: meson-g12a: add IRQ check Sergey Shtylyov
2021-08-08 20:50   ` Martin Blumenstingl
2021-08-09 10:08   ` 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).