public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: dwc3: qcom: simplify error check in dwc3_qcom_find_num_ports()
@ 2026-02-18 11:01 Zeeshan Ahmad
  2026-02-19 22:55 ` Thinh Nguyen
  0 siblings, 1 reply; 12+ messages in thread
From: Zeeshan Ahmad @ 2026-02-18 11:01 UTC (permalink / raw)
  To: Thinh Nguyen, Greg Kroah-Hartman
  Cc: linux-usb, kernel-janitors, linux-kernel, Zeeshan Ahmad

The platform_get_irq_byname_optional() function returns a non-zero
IRQ number on success and a negative error code on failure. It
never returns zero.

The current implementation checks for a return value less than or
equal to zero. Since zero is not a valid return value, simplify
the check to only look for negative error codes.

Signed-off-by: Zeeshan Ahmad <zeeshanahmad022019@gmail.com>
---
 drivers/usb/dwc3/dwc3-qcom-legacy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-qcom-legacy.c b/drivers/usb/dwc3/dwc3-qcom-legacy.c
index d3fad0fcfdac..34c578309802 100644
--- a/drivers/usb/dwc3/dwc3-qcom-legacy.c
+++ b/drivers/usb/dwc3/dwc3-qcom-legacy.c
@@ -620,14 +620,14 @@ static int dwc3_qcom_find_num_ports(struct platform_device *pdev)
 	int irq;
 
 	irq = platform_get_irq_byname_optional(pdev, "dp_hs_phy_1");
-	if (irq <= 0)
+	if (irq < 0)
 		return 1;
 
 	for (port_num = 2; port_num <= DWC3_QCOM_MAX_PORTS; port_num++) {
 		sprintf(irq_name, "dp_hs_phy_%d", port_num);
 
 		irq = platform_get_irq_byname_optional(pdev, irq_name);
-		if (irq <= 0)
+		if (irq < 0)
 			return port_num - 1;
 	}
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread
* [PATCH] usb: dwc3: qcom: simplify error check in dwc3_qcom_find_num_ports()
@ 2026-02-24  7:32 Zeeshan Ahmad
  2026-02-25  0:06 ` Thinh Nguyen
  0 siblings, 1 reply; 12+ messages in thread
From: Zeeshan Ahmad @ 2026-02-24  7:32 UTC (permalink / raw)
  To: Thinh Nguyen, Greg Kroah-Hartman
  Cc: Dan Carpenter, linux-usb, kernel-janitors, linux-kernel,
	Zeeshan Ahmad

The platform_get_irq_byname_optional() function returns a non-zero
IRQ number on success and a negative error code on failure. It
never returns zero.

The current implementation in the modern dwc3-qcom driver checks for
a return value less than or equal to zero. Since zero is not a
valid return value, simplify the check to only look for negative
error codes. This aligns the logic with the standard return contract
of the platform IRQ APIs.

Signed-off-by: Zeeshan Ahmad <zeeshanahmad022019@gmail.com>
---
 drivers/usb/dwc3/dwc3-qcom.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
index 9ac75547820d..f43f73ac36ff 100644
--- a/drivers/usb/dwc3/dwc3-qcom.c
+++ b/drivers/usb/dwc3/dwc3-qcom.c
@@ -526,14 +526,14 @@ static int dwc3_qcom_find_num_ports(struct platform_device *pdev)
 	int irq;
 
 	irq = platform_get_irq_byname_optional(pdev, "dp_hs_phy_1");
-	if (irq <= 0)
+	if (irq < 0)
 		return 1;
 
 	for (port_num = 2; port_num <= DWC3_QCOM_MAX_PORTS; port_num++) {
 		sprintf(irq_name, "dp_hs_phy_%d", port_num);
 
 		irq = platform_get_irq_byname_optional(pdev, irq_name);
-		if (irq <= 0)
+		if (irq < 0)
 			return port_num - 1;
 	}
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-02-26  2:14 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-18 11:01 [PATCH] usb: dwc3: qcom: simplify error check in dwc3_qcom_find_num_ports() Zeeshan Ahmad
2026-02-19 22:55 ` Thinh Nguyen
2026-02-20  8:15   ` Dan Carpenter
2026-02-21 10:41     ` Zeeshan Ahmad
2026-02-24  0:41     ` Thinh Nguyen
2026-02-24  6:44       ` Zeeshan Ahmad
2026-02-25  0:10         ` Thinh Nguyen
2026-02-25  6:42           ` [PATCH v2] " Zeeshan Ahmad
2026-02-25  6:51             ` [PATCH v3] " Zeeshan Ahmad
2026-02-26  2:14               ` Thinh Nguyen
  -- strict thread matches above, loose matches on Subject: below --
2026-02-24  7:32 [PATCH] " Zeeshan Ahmad
2026-02-25  0:06 ` Thinh Nguyen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox