diff mbox series

[2/9] usb: dwc3: qcom: add IRQ check

Message ID 563b7c97-4668-3fd4-310b-0a067e805635@omp.ru (mailing list archive)
State New, archived
Headers show
Series Stop calling devm_request_irq() with invalid IRQs in the USB drivers | expand

Commit Message

Sergey Shtylyov Aug. 8, 2021, 8:41 p.m. UTC
In dwc3_qcom_acpi_register_core(), the driver neglects to check the result
of platform_get_irq()'s call and blithely assigns the negative error codes
to the allocated child device's IRQ resource and then passing this resource
to platform_device_add_resources() and later causing dwc3_otg_get_irq() to
fail anyway.  Stop calling platform_device_add_resources() with the invalid
IRQ #s, so that there's less complexity in the IRQ error checking.

Fixes: 2bc02355f8ba ("usb: dwc3: qcom: Add support for booting with ACPI")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

---
 drivers/usb/dwc3/dwc3-qcom.c |    4 ++++
 1 file changed, 4 insertions(+)

Comments

Felipe Balbi Aug. 9, 2021, 10:07 a.m. UTC | #1
Sergey Shtylyov <s.shtylyov@omp.ru> writes:

> In dwc3_qcom_acpi_register_core(), the driver neglects to check the result
> of platform_get_irq()'s call and blithely assigns the negative error codes
> to the allocated child device's IRQ resource and then passing this resource
> to platform_device_add_resources() and later causing dwc3_otg_get_irq() to
> fail anyway.  Stop calling platform_device_add_resources() with the invalid
> IRQ #s, so that there's less complexity in the IRQ error checking.
>
> Fixes: 2bc02355f8ba ("usb: dwc3: qcom: Add support for booting with ACPI")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

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

Patch

Index: usb/drivers/usb/dwc3/dwc3-qcom.c
===================================================================
--- usb.orig/drivers/usb/dwc3/dwc3-qcom.c
+++ usb/drivers/usb/dwc3/dwc3-qcom.c
@@ -614,6 +614,10 @@  static int dwc3_qcom_acpi_register_core(
 		qcom->acpi_pdata->dwc3_core_base_size;
 
 	irq = platform_get_irq(pdev_irq, 0);
+	if (irq < 0) {
+		ret = irq;
+		goto out;
+	}
 	child_res[1].flags = IORESOURCE_IRQ;
 	child_res[1].start = child_res[1].end = irq;