Skip to contentSkip to conversation

ACPI: debug: Clean up acpi_aml_init()

PATCH In review Rafael J. Wysocki 2 participants 2 messages Jan 24, 2019 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI: debug: Clean up acpi_aml_init()

From: Rafael J. Wysocki <[email protected]>

The err_exit label in acpi_aml_init() is not used any more after commit 9ec6dbfbdc0a ("ACPI: no need to check return value of debugfs_create functions"), but the other label in there is not necessary too, so rearrange the code to get rid of them both.

No intentional functional impact.

Fixes 9ec6dbfbdc0a ("ACPI: no need to check return value of debugfs_create functions")
---
 drivers/acpi/acpi_dbg.c |   15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/acpi/acpi_dbg.c +7 -8
Index: linux-pm/drivers/acpi/acpi_dbg.c
===================================================================
@@ -750,29 +750,28 @@ static const struct acpi_debugger_ops ac
 
 int __init acpi_aml_init(void)
 {
-	int ret = 0;
+	int ret;
 
 	/* Initialize AML IO interface */
 	mutex_init(&acpi_aml_io.lock);
 	init_waitqueue_head(&acpi_aml_io.wait);
 	acpi_aml_io.out_crc.buf = acpi_aml_io.out_buf;
 	acpi_aml_io.in_crc.buf = acpi_aml_io.in_buf;
+
 	acpi_aml_dentry = debugfs_create_file("acpidbg",
 					      S_IFREG | S_IRUGO | S_IWUSR,
 					      acpi_debugfs_dir, NULL,
 					      &acpi_aml_operations);
-	ret = acpi_register_debugger(THIS_MODULE, &acpi_aml_debugger);
-	if (ret)
-		goto err_fs;
-	acpi_aml_initialized = true;
 
-err_fs:
+	ret = acpi_register_debugger(THIS_MODULE, &acpi_aml_debugger);
 	if (ret) {
 		debugfs_remove(acpi_aml_dentry);
 		acpi_aml_dentry = NULL;
+		return ret;
 	}
-err_exit:
-	return ret;
+
+	acpi_aml_initialized = true;
+	return 0;
 }
 
 void __exit acpi_aml_exit(void)
Reviewed-by on v1 1/1
#1 lore raw
Quoted 46 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

The err_exit label in acpi_aml_init() is not used any more after commit 9ec6dbfbdc0a ("ACPI: no need to check return value of debugfs_create functions"), but the other label in there is not necessary too, so rearrange the code to get rid of them both.

No intentional functional impact.

Fixes 9ec6dbfbdc0a ("ACPI: no need to check return value of debugfs_create functions")
---
 drivers/acpi/acpi_dbg.c |   15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

Index: linux-pm/drivers/acpi/acpi_dbg.c
===================================================================

drivers/acpi/acpi_dbg.c +3 -6
@@ -750,29 +750,28 @@ static const struct acpi_debugger_ops ac
 
 int __init acpi_aml_init(void)
 {
-	int ret = 0;
+	int ret;
 
 	/* Initialize AML IO interface */
 	mutex_init(&acpi_aml_io.lock);
 	init_waitqueue_head(&acpi_aml_io.wait);
 	acpi_aml_io.out_crc.buf = acpi_aml_io.out_buf;
 	acpi_aml_io.in_crc.buf = acpi_aml_io.in_buf;
+
 	acpi_aml_dentry = debugfs_create_file("acpidbg",
 					      S_IFREG | S_IRUGO | S_IWUSR,
 					      acpi_debugfs_dir, NULL,
 					      &acpi_aml_operations);
-	ret = acpi_register_debugger(THIS_MODULE, &acpi_aml_debugger);
-	if (ret)
-		goto err_fs;
-	acpi_aml_initialized = true;
 
-err_fs:
+	ret = acpi_register_debugger(THIS_MODULE, &acpi_aml_debugger);
 	if (ret) {
 		debugfs_remove(acpi_aml_dentry);

drivers/acpi/acpi_dbg.c static const struct acpi_debugger_ops ac · line 776

Quoted 10 lines
drivers/acpi/acpi_dbg.c +4 -2
 		acpi_aml_dentry = NULL;
+		return ret;
 	}
-err_exit:
-	return ret;
+
+	acpi_aml_initialized = true;
+	return 0;
 }
 

Odd that 0-day never reported this :(

Sorry about it, and thanks for the patch: