Re: [PATCH v2 2/3] usb: dwc3: gadget: Add support for snps,reserved-endpoints property

From: Thinh Nguyen
Date: Tue Feb 11 2025 - 20:14:37 EST


On Wed, Feb 12, 2025, Thinh Nguyen wrote:
> On Mon, Feb 03, 2025, Andy Shevchenko wrote:
> >
> > +static int dwc3_gadget_parse_reserved_endpoints(struct dwc3 *dwc, const char *propname,
> > + u8 *eps, u8 num)
> > +{
> > + u8 count;
> > + int ret;
> > +
> > + if (!device_property_present(dwc->dev, propname))
> > + return 0;
> > +
> > + ret = device_property_count_u8(dwc->dev, propname);
> > + if (ret < 0)
> > + return ret;
> > + count = ret;
> > +
> > + ret = device_property_read_u8_array(dwc->dev, propname, eps, min(num, count));
>
> Why do min(num, count)? Can we just put the size of the eps array as
> specified by the function doc.
>

Actually ignore this. What you have here is fine.

Thanks,
Thinh