Re: [PATCH] usb: dwc3: qcom: simplify error check in dwc3_qcom_find_num_ports()

From: Thinh Nguyen

Date: Mon Feb 23 2026 - 19:42:28 EST


On Fri, Feb 20, 2026, Dan Carpenter wrote:
> On Thu, Feb 19, 2026 at 10:55:29PM +0000, Thinh Nguyen wrote:
> > On Wed, Feb 18, 2026, Zeeshan Ahmad wrote:
> > > 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
> > >
> >
> > Since this is not a fix, I prefer new development to be on the dwc3-qcom
> > and not the dwc3-qcom-legacy glue.
>
> There might be some static checker warnings for these? Smatch only
> warns if people do an explicit zero check since
> platform_get_irq_byname_optional() can never return zero.
>

But that aside, since this is new development rather than a fix, I'd
prefer to see it go into dwc3-qcom instead of the legacy driver. We
should be pushing new features to the main driver to keep things
consolidated and encourage people to migrate away from the legacy code.

BR,
Thinh