Re: [PATCH 4/6] cxl/mem: Convert devm_cxl_add_memdev() to scope-based-cleanup

From: dan.j.williams

Date: Thu Dec 04 2025 - 15:50:15 EST


Cheatham, Benjamin wrote:
[..]
> > - rc = devm_add_action_or_reset(host, cxl_memdev_unregister, cxlmd);
> > + rc = devm_add_action_or_reset(host, cxl_memdev_unregister,
> > + no_free_ptr(cxlmd));
> > if (rc)
> > return ERR_PTR(rc);
> > return cxlmd;
>
> Isn't cxlmd zeroed out by no_free_ptr() above? I think what needs to happen here is:
>
> rc = devm_add_action_or_reset(host, cxl_memdev_unregister, cxlmd);
> if (rc) {
> no_free_ptr(cxlmd);
> return ERR_PTR(rc);
> }
>
> return_ptr(cxlmd);
>
> Looking ahead, this gets nullified in patch 6/6 so I guess it's only an issue if
> someone is in the middle of a bisect (or doesn't pick up patch 6/6 for some reason).

Good catch! ...and no, I should not leave that bisect problem in the set.

Will pull the cxl_memdev_autoremove() change forward for that.