Skip to contentSkip to conversation

thermal: intel_powerclamp: no need to check return value of debugfs_create functions

PATCH In review Greg Kroah-Hartman 2 participants 2 messages Jun 13, 2019 – Jun 14, 2019 Thermal

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal: intel_powerclamp: 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 Zhang Rui <[email protected]>
Cc Eduardo Valentin <[email protected]>
Cc Daniel Lezcano <[email protected]>
Cc Finn Thain <[email protected]>
---
 drivers/thermal/intel/intel_powerclamp.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
drivers/thermal/intel/intel_powerclamp.c +2 -10
index ac7256b5f020..39c6b589f2ed 100644
@@ -713,17 +713,9 @@ DEFINE_SHOW_ATTRIBUTE(powerclamp_debug);
 static inline void powerclamp_create_debug_files(void)
 {
 	debug_dir = debugfs_create_dir("intel_powerclamp", NULL);
-	if (!debug_dir)
-		return;
-
-	if (!debugfs_create_file("powerclamp_calib", S_IRUGO, debug_dir,
-					cal_data, &powerclamp_debug_fops))
-		goto file_error;
 
-	return;
-
-file_error:
-	debugfs_remove_recursive(debug_dir);
+	debugfs_create_file("powerclamp_calib", S_IRUGO, debug_dir, cal_data,
+			    &powerclamp_debug_fops);
 }
 
 static enum cpuhp_state hp_state;
Signature · 1 line
2.22.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 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 Zhang Rui <[email protected]>
Cc Eduardo Valentin <[email protected]>
Cc Daniel Lezcano <[email protected]>
Cc Finn Thain <[email protected]>
Quoted 29 lines
---
 drivers/thermal/intel/intel_powerclamp.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
drivers/thermal/intel/intel_powerclamp.c +2 -10
index ac7256b5f020..39c6b589f2ed 100644
@@ -713,17 +713,9 @@ DEFINE_SHOW_ATTRIBUTE(powerclamp_debug);
 static inline void powerclamp_create_debug_files(void)
 {
 	debug_dir = debugfs_create_dir("intel_powerclamp", NULL);
-	if (!debug_dir)
-		return;
-
-	if (!debugfs_create_file("powerclamp_calib", S_IRUGO, debug_dir,
-					cal_data, &powerclamp_debug_fops))
-		goto file_error;
 
-	return;
-
-file_error:
-	debugfs_remove_recursive(debug_dir);
+	debugfs_create_file("powerclamp_calib", S_IRUGO, debug_dir, cal_data,
+			    &powerclamp_debug_fops);
 }
 
 static enum cpuhp_state hp_state;
Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog