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/greybus/svc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/greybus/svc.c b/drivers/greybus/svc.c index 4256467fcd35..906ea61cba30 100644 --- a/drivers/greybus/svc.c +++ b/drivers/greybus/svc.c @@ -765,7 +765,7 @@ static void gb_svc_pwrmon_debugfs_init(struct gb_svc *svc) u8 rail_count;
dent = debugfs_create_dir("pwrmon", svc->debugfs_dentry); - if (IS_ERR_OR_NULL(dent)) + if (IS_ERR(dent)) return;
if (gb_svc_pwrmon_rail_count_get(svc, &rail_count))
On Tue, Sep 03, 2024 at 10:40:19PM +0800, 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
drivers/greybus/svc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/greybus/svc.c b/drivers/greybus/svc.c index 4256467fcd35..906ea61cba30 100644 --- a/drivers/greybus/svc.c +++ b/drivers/greybus/svc.c @@ -765,7 +765,7 @@ static void gb_svc_pwrmon_debugfs_init(struct gb_svc *svc) u8 rail_count; dent = debugfs_create_dir("pwrmon", svc->debugfs_dentry);
- if (IS_ERR_OR_NULL(dent))
- if (IS_ERR(dent)) return;
Really the value should not be checked at all, nothing different should happen if, or if not, debugfs is working.
So perhaps just remove the check?
thanks,
greg k-h