Skip to contentSkip to conversation

platform/x86: intel_ips: Remove unnecessary NULL check before debugfs_remove_recursive

PATCH In review Wen Yang 2 participants 2 messages Dec 6, 2018 x86 platform drivers

lore
Share & tools
lore

Wen Yang

author
#0 lore raw

PATCH 1/1 platform/x86: intel_ips: Remove unnecessary NULL check before debugfs_remove_recursive

debugfs_remove_recursive() accepts a NULL parameter and returns immediately, there's no need for a NULL check in the caller.

This issue was detected with the help of Coccinelle.

---
 drivers/platform/x86/intel_ips.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/platform/x86/intel_ips.c +1 -3
index 225638a1b09e..f8175b972537 100644
@@ -1300,9 +1300,7 @@ static const struct file_operations ips_debugfs_ops = {
 
 static void ips_debugfs_cleanup(struct ips_driver *ips)
 {
-	if (ips->debug_root)
-		debugfs_remove_recursive(ips->debug_root);
-	return;
+	debugfs_remove_recursive(ips->debug_root);
 }
 
 static void ips_debugfs_init(struct ips_driver *ips)
Signature · 1 line
2.19.1
#1 lore raw
Quoted 6 lines · Wen Yang

debugfs_remove_recursive() accepts a NULL parameter and returns immediately, there's no need for a NULL check in the caller.

This issue was detected with the help of Coccinelle.

Thank you, similar patch is already in my queue.

Quoted 27 lines
---
 drivers/platform/x86/intel_ips.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/platform/x86/intel_ips.c +1 -4
index 225638a1b09e..f8175b972537 100644
@@ -1300,9 +1300,7 @@ static const struct file_operations ips_debugfs_ops = {
 
 static void ips_debugfs_cleanup(struct ips_driver *ips)
 {
-       if (ips->debug_root)
-               debugfs_remove_recursive(ips->debug_root);
-       return;
+       debugfs_remove_recursive(ips->debug_root);
 }
 
 static void ips_debugfs_init(struct ips_driver *ips)
--

2.19.1

Signature · 2 lines
With Best Regards,
Andy Shevchenko