diff mbox series

[v3,2/2] usb: phy: tahvo: add IRQ check

Message ID 8280d6a4-8e9a-7cfe-1aa9-db586dc9afdf@omp.ru
State New
Headers show
Series Stop calling request_irq(), etc. with invalid IRQs in the USB drivers` | expand

Commit Message

Sergey Shtylyov Aug. 13, 2021, 8:32 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_threaded_irq() (which
takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an
original error code.  Stop calling request_threaded_irq() with the invalid
IRQ #s.

Fixes: 9ba96ae5074c ("usb: omap1: Tahvo USB transceiver driver")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

---
 drivers/usb/phy/phy-tahvo.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Felipe Balbi Aug. 14, 2021, 11:28 a.m. UTC | #1
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_threaded_irq() (which

> takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an

> original error code.  Stop calling request_threaded_irq() with the invalid

> IRQ #s.

>

> Fixes: 9ba96ae5074c ("usb: omap1: Tahvo USB transceiver driver")

> 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/phy/phy-tahvo.c
===================================================================
--- usb.orig/drivers/usb/phy/phy-tahvo.c
+++ usb/drivers/usb/phy/phy-tahvo.c
@@ -393,7 +393,9 @@  static int tahvo_usb_probe(struct platfo
 
 	dev_set_drvdata(&pdev->dev, tu);
 
-	tu->irq = platform_get_irq(pdev, 0);
+	tu->irq = ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
+		return ret;
 	ret = request_threaded_irq(tu->irq, NULL, tahvo_usb_vbus_interrupt,
 				   IRQF_ONESHOT,
 				   "tahvo-vbus", tu);