Re: [PATCH v16 7/9] usb: dwc3: qcom: Refactor IRQ handling in glue driver

From: Johan Hovold
Date: Mon Mar 25 2024 - 11:55:50 EST


On Mon, Mar 25, 2024 at 06:45:07PM +0530, Krishna Kurapati PSSNV wrote:
> >> +static int dwc3_qcom_setup_irq(struct platform_device *pdev)
> >> +{
> >> + struct dwc3_qcom *qcom = platform_get_drvdata(pdev);
> >> + bool is_multiport;
> >> + int ret;
> >> + int i;
> >> +
> >> + qcom->num_ports = dwc3_qcom_find_num_ports(pdev);
> >> + if (qcom->num_ports < 0)
> >> + return -ENOMEM;
> >
> > Just return 'ret' directly.
>
> Sure, will init ret to -ENOMEM and return ret here.

I meant that you should return whatever error dwc3_qcom_find_num_ports()
returns, so perhaps something like:


ret = dwc3_qcom_find_num_ports(pdev);
if (ret < 0)
return ret;

qcom->num_ports = ret;

It looks like dwc3_qcom_find_num_ports() can also return 0 (e.g. on
malformed DT), which also needs to be handled somehow. I missed that
earlier.

Johan