cxl/region: Fix IS_ERR() vs NULL check

The nvdimm_pmem_region_create() function returns NULL on error.  It does
not return error pointers.

Fixes: 04ad63f086 ("cxl/region: Introduce cxl_pmem_region objects")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/Yuo65lq2WtfdGJ0X@kili
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
Dan Carpenter 2022-08-03 12:07:50 +03:00 committed by Dan Williams
parent e29a8995d6
commit 9fd2cf4d6f
1 changed files with 2 additions and 2 deletions

View File

@ -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;
}