Commit 1c987cf2 authored by Li Zhijian's avatar Li Zhijian Committed by Dave Jiang

cxl/region: Fix cxlr_pmem leaks

Before this error path, cxlr_pmem pointed to a kzalloc() memory, free
it to avoid this memory leaking.

Fixes: f17b558d ("cxl/pmem: Refactor nvdimm device registration, delete the workqueue")
Signed-off-by: default avatarLi Zhijian <lizhijian@fujitsu.com>
Reviewed-by: default avatarDan Williams <dan.j.williams@intel.com>
Reviewed-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20240428030748.318985-1-lizhijian@fujitsu.comSigned-off-by: default avatarDave Jiang <dave.jiang@intel.com>
parent 660c0a86
......@@ -2854,6 +2854,7 @@ static struct cxl_pmem_region *cxl_pmem_region_alloc(struct cxl_region *cxlr)
if (i == 0) {
cxl_nvb = cxl_find_nvdimm_bridge(cxlmd);
if (!cxl_nvb) {
kfree(cxlr_pmem);
cxlr_pmem = ERR_PTR(-ENODEV);
goto out;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment