diff options
author | Pierre Gondois <Pierre.Gondois@arm.com> | 2021-10-08 15:46:19 +0100 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2021-10-08 15:39:42 +0000 |
commit | 37bd08176ca7908ad5310c3b28b2e8ffb8a9eaa2 (patch) | |
tree | 69663761956aceab56fb57817e9b69643d7f40d9 /DynamicTablesPkg | |
parent | 2dd7dd3952c78e1c3bc0e512be67a359a091215f (diff) | |
download | edk2-37bd08176ca7908ad5310c3b28b2e8ffb8a9eaa2.tar.gz edk2-37bd08176ca7908ad5310c3b28b2e8ffb8a9eaa2.tar.bz2 edk2-37bd08176ca7908ad5310c3b28b2e8ffb8a9eaa2.zip |
DynamicTablesPkg: Update error handling for node creation
The node creation functions:
- AmlCreateRootNode()
- AmlCreateObjectNode()
- AmlCreateDataNode()
are now resetting the input pointer where the created node is stored.
Thus, it is not necessary to set some local variables to NULL or
check a node value before trying to delete it.
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Diffstat (limited to 'DynamicTablesPkg')
-rw-r--r-- | DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c | 6 | ||||
-rw-r--r-- | DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlClone.c | 2 |
2 files changed, 1 insertions, 7 deletions
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index 4775b68cd9..cbfd9cbb68 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -148,7 +148,6 @@ AmlCodeGenString ( return EFI_INVALID_PARAMETER;
}
- ObjectNode = NULL;
DataNode = NULL;
Status = AmlCreateObjectNode (
@@ -187,10 +186,7 @@ AmlCodeGenString ( return Status;
error_handler:
- if (ObjectNode != NULL) {
- AmlDeleteTree ((AML_NODE_HEADER*)ObjectNode);
- }
-
+ AmlDeleteTree ((AML_NODE_HEADER*)ObjectNode);
return Status;
}
diff --git a/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlClone.c b/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlClone.c index e09372b039..7aafa957a8 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlClone.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlClone.c @@ -43,8 +43,6 @@ AmlCloneNode ( return EFI_INVALID_PARAMETER;
}
- *ClonedNode = NULL;
-
if (IS_AML_DATA_NODE (Node)) {
DataNode = (AML_DATA_NODE*)Node;
Status = AmlCreateDataNode (
|