Re: [PATCH v4 1/3] cxl/core/region: move pmem region driver logic into region_pmem.c

From: Jonathan Cameron

Date: Mon Mar 23 2026 - 14:11:17 EST


On Mon, 23 Mar 2026 10:47:51 -0500
Gregory Price <gourry@xxxxxxxxxx> wrote:

> On Mon, Mar 23, 2026 at 03:08:47PM +0000, Jonathan Cameron wrote:
> > On Sun, 22 Mar 2026 09:16:36 -0400
> > Gregory Price <gourry@xxxxxxxxxx> wrote:
> >
> > > + scoped_guard(device, &cxl_nvb->dev) {
> > > + if (cxl_nvb->dev.driver)
> > > + rc = devm_add_action_or_reset(&cxl_nvb->dev,
> > > + cxlr_pmem_unregister,
> > > + cxlr_pmem);
> > > + else
> > > + rc = -ENXIO;
> > As an example. If we happen to take this path... Where is the device_add() undone?
>
> In many other parts of the code, device_add is not rolled back either
> "for reasons", and - depending on who you talk to - this is
> intentional... for debugging?
>
> I dunno, but the "hanging objects on failure" thing is common throughout
> cxl/ - :shrug:

If it were consistent maybe, but in other paths in this function it is cleaned up...
So I call bug even if it's one that is relatively unlikely to actually happen.

J
>
> ~Gregory