[PATCH] iASL: remove unneeded NULL checks
Colin King
colin.king at canonical.com
Wed Nov 27 13:06:01 UTC 2019
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);
}
--
2.24.0
More information about the fwts-devel
mailing list