summaryrefslogtreecommitdiffstats
path: root/drivers/cxl
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2022-08-03 12:07:50 +0300
committerDan Williams <dan.j.williams@intel.com>2022-08-05 08:41:02 -0700
commit9fd2cf4d6fba8253efa62ba45f623ab7f09df12d (patch)
treec27e13939725ca2cec128b4cdfe83aa4583516c4 /drivers/cxl
parente29a8995d63f6f861b2cc446c58cef430885f469 (diff)
downloadlinux-9fd2cf4d6fba8253efa62ba45f623ab7f09df12d.tar.bz2
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: 04ad63f086d1 ("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>
Diffstat (limited to 'drivers/cxl')
-rw-r--r--drivers/cxl/pmem.c4
1 files 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;
}