Message ID | Yuo65lq2WtfdGJ0X@kili |
---|---|
State | Accepted |
Commit | 9fd2cf4d6fba8253efa62ba45f623ab7f09df12d |
Headers | show |
Series | cxl/region: Fix IS_ERR() vs NULL check | expand |
On Wed, 3 Aug 2022 12:07:50 +0300 Dan Carpenter <dan.carpenter@oracle.com> wrote: > 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> LGTM Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > --- > 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; > } >
Dan Carpenter wrote: > 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> > --- > 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; Thanks, applied.
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; }
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> --- drivers/cxl/pmem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)