MdeModulePkg Variable: Move CacheVariable->InDeletedTransitionPtr NULL pointer check

This change is triggered by R18654 "Enhance variable performance by reading from existed memory cache"
that changed the code to use CacheVariable to improve performance.
So the CacheVariable->InDeletedTransitionPtr NULL pointer check needs to be moved to the place before
it is been used.

Cc: Shumin Qiu <shumin.qiu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Shumin Qiu <shumin.qiu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18688 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Star Zeng 2015-10-28 00:48:43 +00:00 committed by lzeng14
parent 5b5e5674ae
commit ae658d9163
1 changed files with 2 additions and 2 deletions

View File

@ -2280,6 +2280,7 @@ UpdateVariable (
// Both ADDED and IN_DELETED_TRANSITION variable are present,
// set IN_DELETED_TRANSITION one to DELETED state first.
//
ASSERT (CacheVariable->InDeletedTransitionPtr != NULL);
State = CacheVariable->InDeletedTransitionPtr->State;
State &= VAR_DELETED;
Status = UpdateVariableStore (
@ -2293,7 +2294,6 @@ UpdateVariable (
);
if (!EFI_ERROR (Status)) {
if (!Variable->Volatile) {
ASSERT (CacheVariable->InDeletedTransitionPtr != NULL);
CacheVariable->InDeletedTransitionPtr->State = State;
}
} else {
@ -2719,6 +2719,7 @@ UpdateVariable (
// Both ADDED and IN_DELETED_TRANSITION old variable are present,
// set IN_DELETED_TRANSITION one to DELETED state first.
//
ASSERT (CacheVariable->InDeletedTransitionPtr != NULL);
State = CacheVariable->InDeletedTransitionPtr->State;
State &= VAR_DELETED;
Status = UpdateVariableStore (
@ -2732,7 +2733,6 @@ UpdateVariable (
);
if (!EFI_ERROR (Status)) {
if (!Variable->Volatile) {
ASSERT (CacheVariable->InDeletedTransitionPtr != NULL);
CacheVariable->InDeletedTransitionPtr->State = State;
}
} else {