Skip to contentSkip to conversation

acpi: remove a meaningless null check before debugfs_remove

PATCH Applied zhong jiang 2 participants 3 messages Aug 18, 2018 – Sep 14, 2018 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 acpi: remove a meaningless null check before debugfs_remove

debugfs_remove has taken null pointer into account. So it is safe to remove the check before debugfs_remove.

---
 drivers/acpi/custom_method.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/acpi/custom_method.c +1 -2
index e967c11..4451877 100644
@@ -92,8 +92,7 @@ static int __init acpi_custom_method_init(void)
 
 static void __exit acpi_custom_method_exit(void)
 {
-	if (cm_dentry)
-		debugfs_remove(cm_dentry);
+	debugfs_remove(cm_dentry);
 }
 
 module_init(acpi_custom_method_init);
Signature · 1 line
1.7.12.4
#1 lore raw

+to maintainers

Quoted 22 lines · zhong jiang

debugfs_remove has taken null pointer into account. So it is safe to remove the check before debugfs_remove.

---
 drivers/acpi/custom_method.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/acpi/custom_method.c +1 -2
index e967c11..4451877 100644
@@ -92,8 +92,7 @@ static int __init acpi_custom_method_init(void)
 
 static void __exit acpi_custom_method_exit(void)
 {
-	if (cm_dentry)
-		debugfs_remove(cm_dentry);
+	debugfs_remove(cm_dentry);
 }
 
 module_init(acpi_custom_method_init);
#2 lore raw
In reply to zhong jiang
Quoted 14 lines · CEST zhong jiang

debugfs_remove has taken null pointer into account. So it is safe to remove the check before debugfs_remove.

---
 drivers/acpi/custom_method.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/acpi/custom_method.c +0 -0
index e967c11..4451877 100644

drivers/acpi/custom_method.c static int __init acpi_custom_method_init(void) · line 98

Quoted 9 lines
drivers/acpi/custom_method.c +1 -2
@@ -92,8 +92,7 @@ static int __init acpi_custom_method_init(void)
 
 static void __exit acpi_custom_method_exit(void)
 {
-	if (cm_dentry)
-		debugfs_remove(cm_dentry);
+	debugfs_remove(cm_dentry);
 }
 
 module_init(acpi_custom_method_init);

Applied, thanks!