diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2022-08-03 12:07:50 +0300 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2022-08-05 08:41:02 -0700 |
commit | 9fd2cf4d6fba8253efa62ba45f623ab7f09df12d (patch) | |
tree | c27e13939725ca2cec128b4cdfe83aa4583516c4 /drivers/cxl/pmem.c | |
parent | e29a8995d63f6f861b2cc446c58cef430885f469 (diff) | |
download | lwn-9fd2cf4d6fba8253efa62ba45f623ab7f09df12d.tar.gz lwn-9fd2cf4d6fba8253efa62ba45f623ab7f09df12d.zip |
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/pmem.c')
-rw-r--r-- | drivers/cxl/pmem.c | 4 |
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; } |