ACPI: sysfs: Refactor param_get_trace_state() to drop dead code
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 16 Jun 2021 17:03:35 +0000 (20:03 +0300)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 17 Jun 2021 15:10:11 +0000 (17:10 +0200)
The param_get_trace_state() has a few dead code issues:
 - 'return 0;' is never reachable
 - a few 'else' keywords are redundant

Refactor param_get_trace_state() to drop dead code.

Note, leave one 'else' in order to have the best readability.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/sysfs.c

index 5edad91..769f0d9 100644 (file)
@@ -255,16 +255,12 @@ static int param_get_trace_state(char *buffer, const struct kernel_param *kp)
 {
        if (!(acpi_gbl_trace_flags & ACPI_TRACE_ENABLED))
                return sprintf(buffer, "disable\n");
-       else {
-               if (acpi_gbl_trace_method_name) {
-                       if (acpi_gbl_trace_flags & ACPI_TRACE_ONESHOT)
-                               return sprintf(buffer, "method-once\n");
-                       else
-                               return sprintf(buffer, "method\n");
-               } else
-                       return sprintf(buffer, "enable\n");
-       }
-       return 0;
+       if (!acpi_gbl_trace_method_name)
+               return sprintf(buffer, "enable\n");
+       if (acpi_gbl_trace_flags & ACPI_TRACE_ONESHOT)
+               return sprintf(buffer, "method-once\n");
+       else
+               return sprintf(buffer, "method\n");
 }
 
 module_param_call(trace_state, param_set_trace_state, param_get_trace_state,