[PATCH v2 9/9] usb: phy: twl6030: add IRQ checks
From: Sergey Shtylyov <hidden>
Date: 2021-08-09 20:53:26
The driver neglects to check the result of platform_get_irq()'s calls and
blithely passes the negative error codes to request_threaded_irq() (which
takes *unsigned* IRQ #), causing them both to fail with -EINVAL, overriding
an original error code. Stop calling request_threaded_irq() with the
invalid IRQ #s.
Fixes: c33fad0c3748 ("usb: otg: Adding twl6030-usb transceiver driver for OMAP4430")
Signed-off-by: Sergey Shtylyov <redacted>
---
drivers/usb/phy/phy-twl6030-usb.c | 5 +++++
1 file changed, 5 insertions(+)
Index: usb/drivers/usb/phy/phy-twl6030-usb.c
===================================================================--- usb.orig/drivers/usb/phy/phy-twl6030-usb.c
+++ usb/drivers/usb/phy/phy-twl6030-usb.c@@ -348,6 +348,11 @@ static int twl6030_usb_probe(struct plat twl->irq2 = platform_get_irq(pdev, 1); twl->linkstat = MUSB_UNKNOWN; + if (twl->irq1 < 0) + return twl->irq1; + if (twl->irq2 < 0) + return twl->irq2; + twl->comparator.set_vbus = twl6030_set_vbus; twl->comparator.start_srp = twl6030_start_srp;