diff options
Diffstat (limited to 'usr/src/uts/intel/io/acpica/parser/psparse.c')
-rw-r--r-- | usr/src/uts/intel/io/acpica/parser/psparse.c | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/usr/src/uts/intel/io/acpica/parser/psparse.c b/usr/src/uts/intel/io/acpica/parser/psparse.c index 135111966d..d9d6a2944b 100644 --- a/usr/src/uts/intel/io/acpica/parser/psparse.c +++ b/usr/src/uts/intel/io/acpica/parser/psparse.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: psparse - Parser top level AML parse routines - * $Revision: 1.176 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -125,6 +124,7 @@ */ #include "acpi.h" +#include "accommon.h" #include "acparser.h" #include "acdispat.h" #include "amlcode.h" @@ -222,6 +222,7 @@ AcpiPsCompleteThisOp ( ACPI_PARSE_OBJECT *Next; const ACPI_OPCODE_INFO *ParentInfo; ACPI_PARSE_OBJECT *ReplacementOp = NULL; + ACPI_STATUS Status = AE_OK; ACPI_FUNCTION_TRACE_PTR (PsCompleteThisOp, Op); @@ -274,7 +275,7 @@ AcpiPsCompleteThisOp ( ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP); if (!ReplacementOp) { - goto AllocateError; + Status = AE_NO_MEMORY; } break; @@ -294,7 +295,7 @@ AcpiPsCompleteThisOp ( ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP); if (!ReplacementOp) { - goto AllocateError; + Status = AE_NO_MEMORY; } } else if ((Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) && @@ -307,11 +308,13 @@ AcpiPsCompleteThisOp ( ReplacementOp = AcpiPsAllocOp (Op->Common.AmlOpcode); if (!ReplacementOp) { - goto AllocateError; + Status = AE_NO_MEMORY; + } + else + { + ReplacementOp->Named.Data = Op->Named.Data; + ReplacementOp->Named.Length = Op->Named.Length; } - - ReplacementOp->Named.Data = Op->Named.Data; - ReplacementOp->Named.Length = Op->Named.Length; } } break; @@ -321,7 +324,7 @@ AcpiPsCompleteThisOp ( ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP); if (!ReplacementOp) { - goto AllocateError; + Status = AE_NO_MEMORY; } } @@ -379,15 +382,7 @@ Cleanup: /* Now we can actually delete the subtree rooted at Op */ AcpiPsDeleteParseTree (Op); - return_ACPI_STATUS (AE_OK); - - -AllocateError: - - /* Always delete the subtree, even on error */ - - AcpiPsDeleteParseTree (Op); - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS (Status); } @@ -545,12 +540,23 @@ AcpiPsParseAml ( WalkState, WalkState->ParserState.Aml, WalkState->ParserState.AmlSize)); + if (!WalkState->ParserState.Aml) + { + return_ACPI_STATUS (AE_NULL_OBJECT); + } /* Create and initialize a new thread state */ Thread = AcpiUtCreateThreadState (); if (!Thread) { + if (WalkState->MethodDesc) + { + /* Executing a control method - additional cleanup */ + + AcpiDsTerminateControlMethod (WalkState->MethodDesc, WalkState); + } + AcpiDsDeleteWalkState (WalkState); return_ACPI_STATUS (AE_NO_MEMORY); } @@ -731,9 +737,10 @@ AcpiPsParseAml ( } else { - /* On error, delete any return object */ + /* On error, delete any return object or implicit return */ AcpiUtRemoveReference (PreviousWalkState->ReturnDesc); + AcpiDsClearImplicitReturn (PreviousWalkState); } } |