Skip to contentSkip to conversation

bcachefs: Remove redundant null pointer checks in bch2_fs_debug_init()

PATCH New Zhen Ni 1 participant 1 message Aug 29, 2025

lore
Share & tools
lore

Zhen Ni

author
#0 lore raw

PATCH 1/1 bcachefs: Remove redundant null pointer checks in bch2_fs_debug_init()

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.

---
 fs/bcachefs/debug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/bcachefs/debug.c +2 -2
index 07c2a0f73cc2..3aa53a3b5208 100644
@@ -943,7 +943,7 @@ void bch2_fs_debug_init(struct bch_fs *c)
 		strscpy(name, c->name, sizeof(name));
 
 	c->fs_debug_dir = debugfs_create_dir(name, bch_debug);
-	if (IS_ERR_OR_NULL(c->fs_debug_dir))
+	if (IS_ERR(c->fs_debug_dir))
 		return;
 
 	debugfs_create_file("cached_btree_nodes", 0400, c->fs_debug_dir,
@@ -970,7 +970,7 @@ void bch2_fs_debug_init(struct bch_fs *c)
 	bch2_fs_async_obj_debugfs_init(c);
 
 	c->btree_debug_dir = debugfs_create_dir("btrees", c->fs_debug_dir);
-	if (IS_ERR_OR_NULL(c->btree_debug_dir))
+	if (IS_ERR(c->btree_debug_dir))
 		return;
 
 	for (bd = c->btree_debug;
Signature · 1 line
2.20.1