Skip to contentSkip to conversation

mm: cleancache: no need to check return value of debugfs_create functions

PATCH In review Greg Kroah-Hartman 2 participants 2 messages Jan 22, 2019 – Jan 23, 2019 Memory management

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm: cleancache: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this.

---
 mm/cleancache.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
mm/cleancache.c +1 -2
index 2bf12da9baa0..082fdda7aaa6 100644
@@ -305,8 +305,7 @@ static int __init init_cleancache(void)
 {
 #ifdef CONFIG_DEBUG_FS
 	struct dentry *root = debugfs_create_dir("cleancache", NULL);
-	if (root == NULL)
-		return -ENXIO;
+
 	debugfs_create_u64("succ_gets", 0444, root, &cleancache_succ_gets);
 	debugfs_create_u64("failed_gets", 0444, root, &cleancache_failed_gets);
 	debugfs_create_u64("puts", 0444, root, &cleancache_puts);
Signature · 1 line
2.20.1
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Greg Kroah-Hartman

When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this.

Cc Konrad Rzeszutek Wilk <[email protected]>

OK.

or I can push it through my tree but it may be just easier for Andrew too do it

Quoted 23 lines
---
 mm/cleancache.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
mm/cleancache.c +1 -2
index 2bf12da9baa0..082fdda7aaa6 100644
@@ -305,8 +305,7 @@ static int __init init_cleancache(void)
 {
 #ifdef CONFIG_DEBUG_FS
 	struct dentry *root = debugfs_create_dir("cleancache", NULL);
-	if (root == NULL)
-		return -ENXIO;
+
 	debugfs_create_u64("succ_gets", 0444, root, &cleancache_succ_gets);
 	debugfs_create_u64("failed_gets", 0444, root, &cleancache_failed_gets);
 	debugfs_create_u64("puts", 0444, root, &cleancache_puts);
Signature · 1 line
2.20.1