ACK: [PATCH] iASL: remove unneeded NULL checks
ivanhu
ivan.hu at canonical.com
Fri Dec 6 02:15:20 UTC 2019
On 11/27/19 9:06 PM, Colin King wrote:
> From: Erik Schmauss <erik.schmauss at intel.com>
>
> They are unneeded because these functions do not return NULL. In the
> case that these functions fail, they end up aborting the entire
> program rather than returning NULL.
>
> Reported-by: Colin Ian King <colin.king at canonical.com>
> Signed-off-by: Erik Schmauss <erik.schmauss at intel.com>
> (modified to match fwts src/acpica path)
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
> src/acpica/source/compiler/aslfiles.c | 6 ------
> src/acpica/source/compiler/dtcompile.c | 12 +++---------
> 2 files changed, 3 insertions(+), 15 deletions(-)
>
> diff --git a/src/acpica/source/compiler/aslfiles.c b/src/acpica/source/compiler/aslfiles.c
> index b9208c7c..23acc470 100644
> --- a/src/acpica/source/compiler/aslfiles.c
> +++ b/src/acpica/source/compiler/aslfiles.c
> @@ -207,12 +207,6 @@ FlInitOneFile (
> NewFileNode = ACPI_CAST_PTR (ASL_GLOBAL_FILE_NODE,
> UtLocalCacheCalloc (sizeof (ASL_GLOBAL_FILE_NODE)));
>
> - if (!NewFileNode)
> - {
> - AslError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION, NULL, NULL);
> - return (AE_NO_MEMORY);
> - }
> -
> NewFileNode->ParserErrorDetected = FALSE;
> NewFileNode->Next = AslGbl_FilesList;
>
> diff --git a/src/acpica/source/compiler/dtcompile.c b/src/acpica/source/compiler/dtcompile.c
> index bdd8c1b7..80970822 100644
> --- a/src/acpica/source/compiler/dtcompile.c
> +++ b/src/acpica/source/compiler/dtcompile.c
> @@ -276,10 +276,7 @@ DtDoCompile (
>
> if (ACPI_FAILURE (Status))
> {
> - if (FileNode)
> - {
> - FileNode->ParserErrorDetected = TRUE;
> - }
> + FileNode->ParserErrorDetected = TRUE;
>
> /* TBD: temporary error message. Msgs should come from function above */
>
> @@ -306,11 +303,8 @@ DtDoCompile (
>
> /* Save the compile time statistics to the current file node */
>
> - if (FileNode)
> - {
> - FileNode->TotalFields = AslGbl_InputFieldCount;
> - FileNode->OutputByteLength = AslGbl_TableLength;
> - }
> + FileNode->TotalFields = AslGbl_InputFieldCount;
> + FileNode->OutputByteLength = AslGbl_TableLength;
>
> return (Status);
> }
>
Acked-by: Ivan Hu <ivan.hu at canonical.com>
More information about the fwts-devel
mailing list