Linux USB
 help / color / mirror / Atom feed
From: Rosen Penev <rosenp@gmail.com>
To: linux-usb@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] usb: fhci-hcd: use platform_get_irq and simplify error paths
Date: Mon, 27 Jul 2026 12:49:48 -0700	[thread overview]
Message-ID: <20260727194948.11986-1-rosenp@gmail.com> (raw)

Replace irq_of_parse_and_map() with platform_get_irq() to obtain the
USB host interrupt, and move the IRQ lookup earlier in the probe
function before any resources are allocated.

Simplify the error handling by removing the now-unnecessary
irq_dispose_mapping() call and collapsing several error labels
(err_add_hcd, err_clocks, err_get_timer) into fewer targets since
the resource ordering has been streamlined.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/usb/host/fhci-hcd.c | 27 ++++++++++-----------------
 1 file changed, 10 insertions(+), 17 deletions(-)

diff --git a/drivers/usb/host/fhci-hcd.c b/drivers/usb/host/fhci-hcd.c
index 71e785f445a3..f3c7dae5b5b0 100644
--- a/drivers/usb/host/fhci-hcd.c
+++ b/drivers/usb/host/fhci-hcd.c
@@ -568,6 +568,11 @@ static int of_fhci_probe(struct platform_device *ofdev)
 	if (usb_disabled())
 		return -ENODEV;
 
+	/* USB Host interrupt. */
+	usb_irq = platform_get_irq(ofdev, 0);
+	if (usb_irq < 0)
+		return usb_irq;
+
 	sprop = of_get_property(node, "mode", NULL);
 	if (sprop && strcmp(sprop, "host"))
 		return -ENODEV;
@@ -656,7 +661,7 @@ static int of_fhci_probe(struct platform_device *ofdev)
 	if (IS_ERR(fhci->timer)) {
 		ret = PTR_ERR(fhci->timer);
 		dev_err(dev, "failed to request qe timer: %i", ret);
-		goto err_get_timer;
+		goto err_pins;
 	}
 
 	ret = request_irq(fhci->timer->irq, fhci_frame_limit_timer_irq,
@@ -666,14 +671,6 @@ static int of_fhci_probe(struct platform_device *ofdev)
 		goto err_timer_irq;
 	}
 
-	/* USB Host interrupt. */
-	usb_irq = irq_of_parse_and_map(node, 0);
-	if (!usb_irq) {
-		dev_err(dev, "could not get usb irq\n");
-		ret = -EINVAL;
-		goto err_usb_irq;
-	}
-
 	/* Clocks. */
 	sprop = of_get_property(node, "fsl,fullspeed-clock", NULL);
 	if (sprop) {
@@ -681,7 +678,7 @@ static int of_fhci_probe(struct platform_device *ofdev)
 		if (fhci->fullspeed_clk == QE_CLK_DUMMY) {
 			dev_err(dev, "wrong fullspeed-clock\n");
 			ret = -EINVAL;
-			goto err_clocks;
+			goto err_usb_irq;
 		}
 	}
 
@@ -691,7 +688,7 @@ static int of_fhci_probe(struct platform_device *ofdev)
 		if (fhci->lowspeed_clk == QE_CLK_DUMMY) {
 			dev_err(dev, "wrong lowspeed-clock\n");
 			ret = -EINVAL;
-			goto err_clocks;
+			goto err_usb_irq;
 		}
 	}
 
@@ -699,7 +696,7 @@ static int of_fhci_probe(struct platform_device *ofdev)
 			fhci->lowspeed_clk == QE_CLK_NONE) {
 		dev_err(dev, "no clocks specified\n");
 		ret = -EINVAL;
-		goto err_clocks;
+		goto err_usb_irq;
 	}
 
 	dev_info(dev, "at 0x%p, irq %d\n", hcd->regs, usb_irq);
@@ -721,7 +718,7 @@ static int of_fhci_probe(struct platform_device *ofdev)
 
 	ret = usb_add_hcd(hcd, usb_irq, 0);
 	if (ret < 0)
-		goto err_add_hcd;
+		goto err_usb_irq;
 
 	device_wakeup_enable(hcd->self.controller);
 
@@ -729,14 +726,10 @@ static int of_fhci_probe(struct platform_device *ofdev)
 
 	return 0;
 
-err_add_hcd:
-err_clocks:
-	irq_dispose_mapping(usb_irq);
 err_usb_irq:
 	free_irq(fhci->timer->irq, hcd);
 err_timer_irq:
 	gtm_put_timer16(fhci->timer);
-err_get_timer:
 err_pins:
 	while (--j >= 0)
 		qe_pin_free(fhci->pins[j]);
-- 
2.55.0


                 reply	other threads:[~2026-07-27 19:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260727194948.11986-1-rosenp@gmail.com \
    --to=rosenp@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox