[PATCH v2] usb: xhci: tegra: Propagate errors from optional IRQ lookup

From: phucduc . bui

Date: Fri Aug 07 2026 - 02:28:15 EST


From: bui duc phuc <phucduc.bui@xxxxxxxxx>

platform_get_irq_optional() returns a positive IRQ number on success or
a negative error code on failure. For an optional IRQ, -ENXIO indicates
that no IRQ is available, while other errors should be propagated.

Propagate errors such as -EPROBE_DEFER and -EINVAL instead of continuing
probe without the IRQ.

Signed-off-by: bui duc phuc <phucduc.bui@xxxxxxxxx>
---

Links v1:
https://lore.kernel.org/all/20260806063933.27331-1-phucduc.bui@xxxxxxxxx/
Changes in v2:
- Update the commit message and error handling.
- Propagate all errors from platform_get_irq_optional() except -ENXIO,
instead of only handling -EPROBE_DEFER.


drivers/usb/host/xhci-tegra.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c
index e7e6d569f1db..d7ae279acdf0 100644
--- a/drivers/usb/host/xhci-tegra.c
+++ b/drivers/usb/host/xhci-tegra.c
@@ -1571,8 +1571,11 @@ static int tegra_xusb_setup_wakeup(struct platform_device *pdev, struct tegra_xu
struct irq_data *data;

tegra->wake_irqs[i] = platform_get_irq_optional(pdev, i + WAKE_IRQ_START_INDEX);
- if (tegra->wake_irqs[i] < 0)
+ if (tegra->wake_irqs[i] < 0) {
+ if (tegra->wake_irqs[i] != -ENXIO)
+ return tegra->wake_irqs[i];
break;
+ }

data = irq_get_irq_data(tegra->wake_irqs[i]);
if (!data) {
--
2.43.0