acpi: sysfs: Fixed a control flow style issue
PATCH 1/1 acpi: sysfs: Fixed a control flow style issue
Fixed coding style issue.
--- drivers/acpi/sysfs.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/acpi/sysfs.c +9 -9
@@ -254,15 +254,15 @@ 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" ); - } + +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 ; }
Signature · 1 line
2.31.1
Rafael J. Wysocki
maintainerQuoted 2 lines · Clayton Casciato
Fixed coding style issue.
I'm not really sure what issue you are fixing here.
Is it the redundant braces around the nested if () statement?
If so, the flow before and after the patch is different. Is this intentional?
Quoted 37 lines
Signed-off-by Clayton Casciato <[email protected]>--- drivers/acpi/sysfs.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)drivers/acpi/sysfs.c +9
-10@@ -254,15 +254,15 @@ 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" ); - } + +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 ; } --2.31.1
Quoted 7 lines · Rafael J. Wysocki
Quoted 2 lines · Clayton Casciato
Fixed coding style issue.
I'm not really sure what issue you are fixing here.
Checkpatch warns that "else is not generally useful after a break or return".
Quoted 2 lines
Is it the redundant braces around the nested if () statement?
The patch only removes the else clause.
Quoted 2 lines
If so, the flow before and after the patch is different. Is this intentional?
Yes. The patch improves readability by removing the outermost context, reducing the nested conditional complexity.
Thank you for your consideration!
Quoted 37 lines
Quoted 37 lines
Signed-off-by Clayton Casciato <[email protected]>--- drivers/acpi/sysfs.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)drivers/acpi/sysfs.c +9
-10@@ -254,15 +254,15 @@ 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" ); - } + +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 ; } --2.31.1