]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
usb: dwc3: qcom: simplify error check in dwc3_qcom_find_num_ports()
authorZeeshan Ahmad <zeeshanahmad022019@gmail.com>
Wed, 25 Feb 2026 06:51:57 +0000 (11:51 +0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 11 Mar 2026 14:23:37 +0000 (15:23 +0100)
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>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://patch.msgid.link/20260225065157.8952-1-zeeshanahmad022019@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/dwc3/dwc3-qcom.c

index 9ac75547820d978b4a32e570e5f59a2807be68a2..f43f73ac36ff1aaf05de9483208d66a881257d0e 100644 (file)
@@ -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;
        }