lkml.org 
[lkml]   [2020]   [Nov]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] locking/lock_events: no need to check return value of debugfs_create functions
Date
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.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
kernel/locking/lock_events.c | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/kernel/locking/lock_events.c b/kernel/locking/lock_events.c
index fa2c2f9..bac77a1 100644
--- a/kernel/locking/lock_events.c
+++ b/kernel/locking/lock_events.c
@@ -146,9 +146,6 @@ static int __init init_lockevent_counts(void)
struct dentry *d_counts = debugfs_create_dir(LOCK_EVENTS_DIR, NULL);
int i;

- if (!d_counts)
- goto out;
-
/*
* Create the debugfs files
*
@@ -159,21 +156,13 @@ static int __init init_lockevent_counts(void)
for (i = 0; i < lockevent_num; i++) {
if (skip_lockevent(lockevent_names[i]))
continue;
- if (!debugfs_create_file(lockevent_names[i], 0400, d_counts,
- (void *)(long)i, &fops_lockevent))
- goto fail_undo;
+ debugfs_create_file(lockevent_names[i], 0400, d_counts,
+ (void *)(long)i, &fops_lockevent);
}

- if (!debugfs_create_file(lockevent_names[LOCKEVENT_reset_cnts], 0200,
- d_counts, (void *)(long)LOCKEVENT_reset_cnts,
- &fops_lockevent))
- goto fail_undo;
+ debugfs_create_file(lockevent_names[LOCKEVENT_reset_cnts], 0200, d_counts,
+ (void *)(long)LOCKEVENT_reset_cnts, &fops_lockevent);

return 0;
-fail_undo:
- debugfs_remove_recursive(d_counts);
-out:
- pr_warn("Could not create '%s' debugfs entries\n", LOCK_EVENTS_DIR);
- return -ENOMEM;
}
fs_initcall(init_lockevent_counts);
--
2.1.0
\
 
 \ /
  Last update: 2020-11-07 10:21    [W:0.410 / U:0.672 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site