acpi: remove unnecessary parenthesis from return statement
Subsystems (2)
PATCH v2 1/1 acpi: remove unnecessary parenthesis from return statement
checkpatch.pl is generating a warning when return value is enclosed in parenthesis. Remove the parenthesis to improve code readability.
--- drivers/acpi/acpica/dbconvert.c | 43 +++++++++++++++------------------ 1 file changed, 19 insertions(+), 24 deletions(-)
drivers/acpi/acpica/dbconvert.c +19 -24
@@ -31,9 +31,8 @@ acpi_status acpi_db_hex_char_to_value(int hex_char, u8 *return_value)/* Digit must be ascii [0-9a-fA-F] */ -if (!isxdigit (hex_char)) { -return (AE_BAD_HEX_CONSTANT ); - } +if (!isxdigit (hex_char)) +return AE_BAD_HEX_CONSTANT ;if (hex_char <=0x39 ) { value = (u8)(hex_char -0x30 );
@@ -42,7 +41,7 @@ acpi_status acpi_db_hex_char_to_value(int hex_char, u8 *return_value) } *return_value = value; -return (AE_OK ); +return AE_OK ; }/*******************************************************************************
@@ -68,19 +67,17 @@ static acpi_status acpi_db_hex_byte_to_binary(char *hex_byte, u8 *return_value)/* High byte */ status =acpi_db_hex_char_to_value (hex_byte[0 ], &local0); -if (ACPI_FAILURE (status)) { -return (status); - } +if (ACPI_FAILURE (status)) +return status;/* Low byte */ status =acpi_db_hex_char_to_value (hex_byte[1 ], &local1); -if (ACPI_FAILURE (status)) { -return (status); - } +if (ACPI_FAILURE (status)) +return status; *return_value = (u8)((local0 <<4 ) | local1); -return (AE_OK ); +return AE_OK ; }/*******************************************************************************
@@ -122,9 +119,8 @@ acpi_db_convert_to_buffer(char *string, union acpi_object *object) } buffer =ACPI_ALLOCATE (length); -if (!buffer) { -return (AE_NO_MEMORY ); - } +if (!buffer) +return AE_NO_MEMORY ;/* Convert the command line bytes to the buffer */
@@ -132,7 +128,7 @@ acpi_db_convert_to_buffer(char *string, union acpi_object *object) status =acpi_db_hex_byte_to_binary (&string[i], &buffer[j]);if (ACPI_FAILURE (status)) {ACPI_FREE (buffer); -return (status); +return status; } j++;
@@ -145,7 +141,7 @@ acpi_db_convert_to_buffer(char *string, union acpi_object *object) object->type =ACPI_TYPE_BUFFER ; object->buffer.pointer = buffer; object->buffer.length = length; -return (AE_OK ); +return AE_OK ; }/*******************************************************************************
@@ -175,7 +171,7 @@ acpi_status acpi_db_convert_to_package(char *string, union acpi_object *object)ACPI_ALLOCATE_ZEROED (DB_DEFAULT_PKG_ELEMENTS *sizeof (union acpi_object ));if (!elements) -return (AE_NO_MEMORY ); +return AE_NO_MEMORY ; this = string;for (i =0 ; i < (DB_DEFAULT_PKG_ELEMENTS -1 ); i++) {
@@ -190,7 +186,7 @@ acpi_status acpi_db_convert_to_package(char *string, union acpi_object *object)if (ACPI_FAILURE (status)) {acpi_db_delete_objects (i +1 , elements);ACPI_FREE (elements); -return (status); +return status; } this = next;
@@ -199,7 +195,7 @@ acpi_status acpi_db_convert_to_package(char *string, union acpi_object *object) object->type =ACPI_TYPE_PACKAGE ; object->package.count = i; object->package.elements = elements; -return (AE_OK ); +return AE_OK ; }/*******************************************************************************
@@ -251,7 +247,7 @@ acpi_db_convert_to_object(acpi_object_type type,break ; } -return (status); +return status; }/*******************************************************************************
@@ -272,9 +268,8 @@ u8 *acpi_db_encode_pld_buffer(struct acpi_pld_info *pld_info)u32 dword; buffer =ACPI_ALLOCATE_ZEROED (ACPI_PLD_BUFFER_SIZE ); -if (!buffer) { -return (NULL ); - } +if (!buffer) +return NULL ;/* First 32 bits */
@@ -331,7 +326,7 @@ u8 *acpi_db_encode_pld_buffer(struct acpi_pld_info *pld_info)ACPI_MOVE_32_TO_32 (&buffer[4 ], &dword); } -return (ACPI_CAST_PTR (u8, buffer)); +return ACPI_CAST_PTR (u8, buffer); }/*******************************************************************************
Signature · 1 line
2.34.1
Quoted 2 lines
checkpatch.pl is generating a warning when return value is enclosed in parenthesis. Remove the parenthesis to improve code readability.
parentheses?
You propose to omit also some curly brackets, don't you?
…> ---
Quoted 1 line
drivers/acpi/acpica/dbconvert.c | 43 +++++++++++++++------------------
…
Did you overlook the addition of patch version descriptions?
https://lore.kernel.org/all/?q=%22This+looks+like+a+new+version+of+a+previously+submitted+patch%22
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.16#n310
Regards,
Markus
Quoted 3 lines · Markus Elfring
Quoted 2 lines
checkpatch.pl is generating a warning when return value is enclosed in parenthesis. Remove the parenthesis to improve code readability.
parentheses?
This is my first patch, so i am not sure what you mean by this.
Quoted 2 lines
You propose to omit also some curly brackets, don't you?
ok, i will include this in the next version.
Quoted 8 lines
…> ---
Quoted 1 line
drivers/acpi/acpica/dbconvert.c | 43 +++++++++++++++------------------…
Did you overlook the addition of patch version descriptions?
https://lore.kernel.org/all/?q=%22This+looks+like+a+new+version+of+a+previously+submitted+patch%22
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.16#n310
yes, went through the document, thanks for the information. I will add the change log in next version.
Thanks for reviewing the patch and feedback.
Regards,
Diksha
Quoted 2 lines
Regards,
Markus
Rafael J. Wysocki
maintainerQuoted 3 lines · Diksha Kumari
checkpatch.pl is generating a warning when return value is enclosed in parenthesis. Remove the parenthesis to improve code readability.
Teach checkpatch.pl to skip the ACPICA code instead. Seriously.
This code is generated semi-automatically out of the upstream ACPICA code hosted on GitHub and it follows its own code-style rules. Don't change it manually unless you have made a corresponding change upstream.
Thanks!
Quoted 145 lines
Signed-off-by Diksha Kumari <[email protected]>--- drivers/acpi/acpica/dbconvert.c | 43 +++++++++++++++------------------ 1 file changed, 19 insertions(+), 24 deletions(-)drivers/acpi/acpica/dbconvert.c +19
-25@@ -31,9 +31,8 @@ acpi_status acpi_db_hex_char_to_value(int hex_char, u8 *return_value)/* Digit must be ascii [0-9a-fA-F] */ -if (!isxdigit (hex_char)) { -return (AE_BAD_HEX_CONSTANT ); - } +if (!isxdigit (hex_char)) +return AE_BAD_HEX_CONSTANT ;if (hex_char <=0x39 ) { value = (u8)(hex_char -0x30 );@@ -42,7 +41,7 @@ acpi_status acpi_db_hex_char_to_value(int hex_char, u8 *return_value) } *return_value = value; -return (AE_OK ); +return AE_OK ; }/******************************************************************************* @@ -68,19 +67,17 @@ static acpi_status acpi_db_hex_byte_to_binary(char *hex_byte, u8 *return_value)/* High byte */ status =acpi_db_hex_char_to_value (hex_byte[0 ], &local0); -if (ACPI_FAILURE (status)) { -return (status); - } +if (ACPI_FAILURE (status)) +return status;/* Low byte */ status =acpi_db_hex_char_to_value (hex_byte[1 ], &local1); -if (ACPI_FAILURE (status)) { -return (status); - } +if (ACPI_FAILURE (status)) +return status; *return_value = (u8)((local0 <<4 ) | local1); -return (AE_OK ); +return AE_OK ; }/******************************************************************************* @@ -122,9 +119,8 @@ acpi_db_convert_to_buffer(char *string, union acpi_object *object) } buffer =ACPI_ALLOCATE (length); -if (!buffer) { -return (AE_NO_MEMORY ); - } +if (!buffer) +return AE_NO_MEMORY ;/* Convert the command line bytes to the buffer */ @@ -132,7 +128,7 @@ acpi_db_convert_to_buffer(char *string, union acpi_object *object) status =acpi_db_hex_byte_to_binary (&string[i], &buffer[j]);if (ACPI_FAILURE (status)) {ACPI_FREE (buffer); -return (status); +return status; } j++;@@ -145,7 +141,7 @@ acpi_db_convert_to_buffer(char *string, union acpi_object *object) object->type =ACPI_TYPE_BUFFER ; object->buffer.pointer = buffer; object->buffer.length = length; -return (AE_OK ); +return AE_OK ; }/******************************************************************************* @@ -175,7 +171,7 @@ acpi_status acpi_db_convert_to_package(char *string, union acpi_object *object)ACPI_ALLOCATE_ZEROED (DB_DEFAULT_PKG_ELEMENTS *sizeof (union acpi_object ));if (!elements) -return (AE_NO_MEMORY ); +return AE_NO_MEMORY ; this = string;for (i =0 ; i < (DB_DEFAULT_PKG_ELEMENTS -1 ); i++) {@@ -190,7 +186,7 @@ acpi_status acpi_db_convert_to_package(char *string, union acpi_object *object)if (ACPI_FAILURE (status)) {acpi_db_delete_objects (i +1 , elements);ACPI_FREE (elements); -return (status); +return status; } this = next;@@ -199,7 +195,7 @@ acpi_status acpi_db_convert_to_package(char *string, union acpi_object *object) object->type =ACPI_TYPE_PACKAGE ; object->package.count = i; object->package.elements = elements; -return (AE_OK ); +return AE_OK ; }/******************************************************************************* @@ -251,7 +247,7 @@ acpi_db_convert_to_object(acpi_object_type type,break ; } -return (status); +return status; }/******************************************************************************* @@ -272,9 +268,8 @@ u8 *acpi_db_encode_pld_buffer(struct acpi_pld_info *pld_info)u32 dword; buffer =ACPI_ALLOCATE_ZEROED (ACPI_PLD_BUFFER_SIZE ); -if (!buffer) { -return (NULL ); - } +if (!buffer) +return NULL ;/* First 32 bits */ @@ -331,7 +326,7 @@ u8 *acpi_db_encode_pld_buffer(struct acpi_pld_info *pld_info)ACPI_MOVE_32_TO_32 (&buffer[4 ], &dword); } -return (ACPI_CAST_PTR (u8, buffer)); +return ACPI_CAST_PTR (u8, buffer); }/******************************************************************************* -- 2.34.1