Message ID | 20240903143911.2005193-1-lizetao1@huawei.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [-next] nvdimm: Remove redundant null pointer checks | expand |
On 9/3/24 7:39 AM, Li Zetao wrote: > Since the debugfs_create_dir() never returns a null pointer, checking > the return value for a null pointer is redundant, and using IS_ERR is > safe enough. > > Signed-off-by: Li Zetao <lizetao1@huawei.com> Reviewed-by: Dave Jiang <dave.jiang@intel.com> > --- > drivers/nvdimm/btt.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c > index 423dcd190906..4592c86d5eac 100644 > --- a/drivers/nvdimm/btt.c > +++ b/drivers/nvdimm/btt.c > @@ -227,7 +227,7 @@ static void arena_debugfs_init(struct arena_info *a, struct dentry *parent, > > snprintf(dirname, 32, "arena%d", idx); > d = debugfs_create_dir(dirname, parent); > - if (IS_ERR_OR_NULL(d)) > + if (IS_ERR(d)) > return; > a->debugfs_dir = d; > > @@ -1703,7 +1703,7 @@ static int __init nd_btt_init(void) > int rc = 0; > > debugfs_root = debugfs_create_dir("btt", NULL); > - if (IS_ERR_OR_NULL(debugfs_root)) > + if (IS_ERR(debugfs_root)) > rc = -ENXIO; > > return rc;
diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c index 423dcd190906..4592c86d5eac 100644 --- a/drivers/nvdimm/btt.c +++ b/drivers/nvdimm/btt.c @@ -227,7 +227,7 @@ static void arena_debugfs_init(struct arena_info *a, struct dentry *parent, snprintf(dirname, 32, "arena%d", idx); d = debugfs_create_dir(dirname, parent); - if (IS_ERR_OR_NULL(d)) + if (IS_ERR(d)) return; a->debugfs_dir = d; @@ -1703,7 +1703,7 @@ static int __init nd_btt_init(void) int rc = 0; debugfs_root = debugfs_create_dir("btt", NULL); - if (IS_ERR_OR_NULL(debugfs_root)) + if (IS_ERR(debugfs_root)) rc = -ENXIO; return rc;
Since the debugfs_create_dir() never returns a null pointer, checking the return value for a null pointer is redundant, and using IS_ERR is safe enough. Signed-off-by: Li Zetao <lizetao1@huawei.com> --- drivers/nvdimm/btt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)