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

[email protected]
Newsgroups org.kernel.vger.linux-kernel,org.kernel.vger.linux-tegra,org.kernel.vger.linux-usb
Message-ID <[email protected]>
From: bui duc phuc <[email protected]>

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 <[email protected]>
---

Links v1:
https://lore.kernel.org/all/[email protected]/
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.