From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 380513D092F for ; Mon, 27 Jul 2026 19:49:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785181792; cv=none; b=tyDEJuYI/O5WpaqQGRYnAM34rXPe4DdZKCNAUhKFmkCH36N3VXb8/crY4rhzPoLWjCWZ75ebCJQcC5UJYH2gMgDjQwd34MdrSg6rM8/vyYYF2prQDeekaR0kHajNqaqR7lLEEv59OYPwvi5mut6pQRtkvVQSVO6wQazps28Rbg4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785181792; c=relaxed/simple; bh=BRQMwae0Lj5J72anr9l1FJ5BVmWq41OUaDFBJx92swM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=RSCqYIJIm+X6RhDiV/RHdN5WXDbJ7a0HV6lOq7kiPWgIzeneYIS9QGvgF2CDvYKeUms/9dPzESMv05myytMLANnqxIkZj6RxcNmT/9urXD8qvJFhQeeo7xL1upHRnsVkbxNPxtMLQWExYpYDKa6rQxssFYDkueplYFppNLg/qbg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UoBfalOj; arc=none smtp.client-ip=209.85.214.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UoBfalOj" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-2cfbbdfa60bso28857915ad.3 for ; Mon, 27 Jul 2026 12:49:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785181790; x=1785786590; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=zRaEv6hGRWocOtrE7AchWcpxUOZ3D0iIjgKbMAmvVyk=; b=UoBfalOjvPtfqvys7h1LnoA5At9/4LJKq83tSO3gFgGnYnxUKCEHcnBDaxXOjLwryv Y2wjgypM+YIhPqkfDPq0gtV70SuoFgYxXpK1Xt0Taw5NAsPJmAoEpPQ34eKeMl1KD9aN DTdQclJGgxjM6JO4EAPlpA/PmHM/8hcJNBs3POLQQJaVQY8oW35TxWaZCuXZiBre/YRD sXt0a1z1kamj/ryO2gcUSdAKMZrqHQbpV802fJzS5/euvVAOsjS4Eh7IJnUUeNtF0Yww +f20dfY4DS04L0eGWSGXtDm9qYwLv6IwNOIjfxq5jlcDfQzT8R4JoxRZm/BZI0j2jVOo p5SQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785181790; x=1785786590; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=zRaEv6hGRWocOtrE7AchWcpxUOZ3D0iIjgKbMAmvVyk=; b=djpcPIA6NFDYoUI0l2fZAOTA4d2Q/qHucfiwDn6nUlOCjSoF2xLK16fpEYcBNcVR/n NJDYC1C71Um31nqogI+NwXQHvtnUmQL0fj+e9PTbXmr6kqb266H+6XZMOeYSVcFzuoPU Qv7/HoRHPYoCl0RtQkVpc5gvgX6NmU3XD9OAbC6r/c4urLsBjRmUUzLWZj2VrF7NBjky P9kbQY6802pTJ7/gl0ax1Yiu5PKzYQC7h9YJodAbCvUwKU3shHBO/IL3XoKGsUT87U6d 1yK5G8XyUiUMi9svE/YBj8NnVPeQEY6WPH0QlEedu5YC+JvXC9O6LQW7KiDvjM1HKHiC xNMg== X-Forwarded-Encrypted: i=1; AHgh+Rq79bMHi3ot8zCUNYt9kobZQGhS9+l7JSVlCSCsuVawuH097xPHp8zGJfhVeA6rE2fntCA+XoWx/0szNYI=@vger.kernel.org X-Gm-Message-State: AOJu0YwNZhxsmAa5lYDvZkCJGUO3/Kzx2bFMnIp0AOBdIcEJCBTOEsXr 4cu2nPZBzRjQC7noRIlkZTc6A68n9hWAZJ58O2fEC/4VkDdm83FxbWlX+vTFyawo X-Gm-Gg: AR+sD118yf5nagcrDla3ZkKS0TwNaKfu2QbsXi/Aegdn/9E97n/k8kMjODJhomeU9EF qdBqHU8qcGMLOM6gPxyjph/7nVDVDZawDDuULDT394/ewtDIYgZdZVprxpy631D2bOcX/AChsEI ZO+L/zA2InXlw9Bku9aUYmhcOy4+VxlLI08bp0hip2ijMMBdNbuFiMS1v1x1UXkcM9sKl89oi4l YI1okuc1GylrEgRW4HJIDdv711udLj53Dr6ewhl8kfTY7WzH+UJWDZXIiWZcQDfxzhJQoFGRopg UE5WBuwLWFcUwJ4BiiJ+zDHHBouXqDNQd2gETzidAiLP05J7sWPck7jgbM0U7fECOb6TnefKlnO HHO1dxhmErKpjGQTXcGAo7jF+2IdeB/NvqBgtTlzDNIu+MdEcxM0lh84ob/I+V58Rvd8YX8S3YH E5fvFWOMfFRR+HMUBOgoELf5+OGGwrdFYAcc3TDd5W+oZ8aimM/50PH8H8NJJYIOonoON7SYKLr 8MnUs6wqSTDh3gLKsbSIl5WiQXzulnTZM2j96onZOW5AHSBB/U1XrCZ1M4edpP1OA== X-Received: by 2002:a17:903:230d:b0:2c0:e2ea:6b0c with SMTP id d9443c01a7336-2cfde7afdb0mr96154625ad.21.1785181790406; Mon, 27 Jul 2026 12:49:50 -0700 (PDT) Received: from ryzen.lan ([2601:644:8000:7a86::e34]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2cfde7eea52sm41116395ad.61.2026.07.27.12.49.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2026 12:49:49 -0700 (PDT) From: Rosen Penev To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , 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 Message-ID: <20260727194948.11986-1-rosenp@gmail.com> X-Mailer: git-send-email 2.55.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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