Re: [PATCH v2] usb: dwc3: host: remove dead code in dwc3_host_get_irq()

From: Dan Carpenter
Date: Thu Mar 23 2023 - 07:01:08 EST


Here is how I would write that function, but I can't justify sending it
because it's just a matter of personal taste.

diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
index f6f13e7f1ba1..fcc831ac3236 100644
--- a/drivers/usb/dwc3/host.c
+++ b/drivers/usb/dwc3/host.c
@@ -36,32 +36,28 @@ static int dwc3_host_get_irq(struct dwc3 *dwc)
irq = platform_get_irq_byname_optional(dwc3_pdev, "host");
if (irq > 0) {
dwc3_host_fill_xhci_irq_res(dwc, irq, "host");
- goto out;
+ return irq;
}

if (irq == -EPROBE_DEFER)
- goto out;
+ return -EPROBE_DEFER;

irq = platform_get_irq_byname_optional(dwc3_pdev, "dwc_usb3");
if (irq > 0) {
dwc3_host_fill_xhci_irq_res(dwc, irq, "dwc_usb3");
- goto out;
+ return irq;
}

if (irq == -EPROBE_DEFER)
- goto out;
+ return -EPROBE_DEFER;

irq = platform_get_irq(dwc3_pdev, 0);
if (irq > 0) {
dwc3_host_fill_xhci_irq_res(dwc, irq, NULL);
- goto out;
+ return irq;
}

- if (!irq)
- irq = -EINVAL;
-
-out:
- return irq;
+ return -ENODEV;
}

int dwc3_host_init(struct dwc3 *dwc)