On 09.06.25 18:25:23, Koralahalli Channabasappa, Smita wrote:
> On 6/9/2025 5:54 AM, Jonathan Cameron wrote:
> > On Tue, 3 Jun 2025 22:19:47 +0000
> > Smita Koralahalli <smita.koralahallichannabasa...@amd.com> wrote:

> > > +static int __cxl_region_softreserv_update(struct resource *soft,
> > > +                                   void *_cxlr)
> > > +{
> > > + struct cxl_region *cxlr = _cxlr;
> > > + struct resource *res = cxlr->params.res;
> > > +
> > > + /* Skip non-intersecting soft-reserved regions */
> > > + if (soft->end < res->start || soft->start > res->end)
> > > +         return 0;
> > > +
> > > + soft = normalize_resource(soft);
> > > + if (!soft)
> > > +         return -EINVAL;
> > > +
> > > + remove_soft_reserved(cxlr, soft, res->start, res->end);
> > > +
> > > + return 0;
> > > +}
> > > +
> > > +int cxl_region_softreserv_update(void)
> > > +{
> > > + struct device *dev = NULL;
> > > +
> > > + while ((dev = bus_find_next_device(&cxl_bus_type, dev))) {
> > > +         struct device *put_dev __free(put_device) = dev;
> > This free is a little bit outside of the constructor and destructor
> > together rules.
> > 
> > I wonder if bus_for_each_dev() is cleaner here or is there a reason
> > we have to have released the subsystem lock + grabbed the device
> > one before calling __cxl_region_softreserv_update?
> 
> Thanks for the suggestion. I will replace the bus_find_next_device() with
> bus_for_each_dev(). I think bus_for_each_dev() simplifies the flow as
> there's also no need to call put_device() explicitly.

That change makes path #1 obsolete (see comments there too). I would
prefer to remove it.

Thanks,

-Robert

Reply via email to