Skip to content

Commit 86987c7

Browse files
committed
cxl/region: Cleanup target list on attach error
Jonathan noticed that the target list setup is not unwound completely upon error. Undo all the setup in the 'err_decrement:' exit path. Fixes: 27b3f8d ("cxl/region: Program target lists") Reported-by: Jonathan Cameron <[email protected]> Link: http://lore.kernel.org/r/[email protected] Reviewed-by: Ira Weiny <[email protected]> Reviewed-by: Vishal Verma <[email protected]> Reviewed-by: Jonathan Cameron <[email protected]> Link: https://lore.kernel.org/r/167601996980.1924368.390423634911157277.stgit@dwillia2-xfh.jf.intel.com Signed-off-by: Dan Williams <[email protected]>
1 parent 3528b1e commit 86987c7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/cxl/core/region.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,6 +1347,8 @@ static int cxl_region_attach(struct cxl_region *cxlr,
13471347

13481348
err_decrement:
13491349
p->nr_targets--;
1350+
cxled->pos = -1;
1351+
p->targets[pos] = NULL;
13501352
err:
13511353
for (iter = ep_port; !is_cxl_root(iter);
13521354
iter = to_cxl_port(iter->dev.parent))

0 commit comments

Comments
 (0)