The nvdimm_pmem_region_create() function returns NULL on error. It does not return error pointers. Fixes: 04ad63f086d1 ("cxl/region: Introduce cxl_pmem_region objects") Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> --- drivers/cxl/pmem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/cxl/pmem.c b/drivers/cxl/pmem.c index e69f99a0747d..7dc0a2fa1a6b 100644 --- a/drivers/cxl/pmem.c +++ b/drivers/cxl/pmem.c @@ -525,8 +525,8 @@ static int cxl_pmem_region_probe(struct device *dev) cxlr_pmem->nd_region = nvdimm_pmem_region_create(cxl_nvb->nvdimm_bus, &ndr_desc); - if (IS_ERR(cxlr_pmem->nd_region)) { - rc = PTR_ERR(cxlr_pmem->nd_region); + if (!cxlr_pmem->nd_region) { + rc = -ENOMEM; goto err; } -- 2.35.1