Skip to contentSkip to conversation

timekeeping_debug: no need to check return value of debugfs_create functions

PATCH New Greg Kroah-Hartman 2 participants 2 messages Jan 22, 2019 – Jan 29, 2019 Timekeeping, clocksource core, NTP, alarmtimer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 timekeeping_debug: 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.

Cc John Stultz <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Stephen Boyd <[email protected]>
---
 kernel/time/timekeeping_debug.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
kernel/time/timekeeping_debug.c +2 -9
index 86489950d690..b73e8850e58d 100644
@@ -37,15 +37,8 @@ DEFINE_SHOW_ATTRIBUTE(tk_debug_sleep_time);
 
 static int __init tk_debug_sleep_time_init(void)
 {
-	struct dentry *d;
-
-	d = debugfs_create_file("sleep_time", 0444, NULL, NULL,
-		&tk_debug_sleep_time_fops);
-	if (!d) {
-		pr_err("Failed to create sleep_time debug file\n");
-		return -ENOMEM;
-	}
-
+	debugfs_create_file("sleep_time", 0444, NULL, NULL,
+			    &tk_debug_sleep_time_fops);
 	return 0;
 }
 late_initcall(tk_debug_sleep_time_init);
Signature · 1 line
2.20.1
#1 lore raw

[tip:timers/core] timekeeping/debug: No need to check return value of debugfs_create functions

timekeeping/debug: No need to check return value of debugfs_create functions
Commit-ID:  ae503ab04913794b12e1939caa75aa091062a1b3
Gitweb:     https://git.kernel.org/tip/ae503ab04913794b12e1939caa75aa091062a1b3
Author:     Greg Kroah-Hartman <[email protected]>
AuthorDate: Tue, 22 Jan 2019 16:21:42 +0100
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Tue, 29 Jan 2019 20:08:41 +0100

timekeeping/debug: 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.

---
 kernel/time/timekeeping_debug.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
kernel/time/timekeeping_debug.c +2 -9
index 86489950d690..b73e8850e58d 100644
@@ -37,15 +37,8 @@ DEFINE_SHOW_ATTRIBUTE(tk_debug_sleep_time);
 
 static int __init tk_debug_sleep_time_init(void)
 {
-	struct dentry *d;
-
-	d = debugfs_create_file("sleep_time", 0444, NULL, NULL,
-		&tk_debug_sleep_time_fops);
-	if (!d) {
-		pr_err("Failed to create sleep_time debug file\n");
-		return -ENOMEM;
-	}
-
+	debugfs_create_file("sleep_time", 0444, NULL, NULL,
+			    &tk_debug_sleep_time_fops);
 	return 0;
 }
 late_initcall(tk_debug_sleep_time_init);