summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/DriverSampleDxe
diff options
context:
space:
mode:
authorEric Dong <eric.dong@intel.com>2014-03-27 07:08:15 +0000
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>2014-03-27 07:08:15 +0000
commit2c775600d5131cd9b55552f938750c7bdb36c478 (patch)
tree606ea2fb1746273abe0938b0d8a0b689703717ca /MdeModulePkg/Universal/DriverSampleDxe
parent3bf04a71bff3d414cd3f880ccf7243c12d0f7268 (diff)
downloadedk2-platforms-2c775600d5131cd9b55552f938750c7bdb36c478.tar.xz
Update code logic, remove ASSERT and use error handling.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15403 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/DriverSampleDxe')
-rw-r--r--MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c42
1 files changed, 33 insertions, 9 deletions
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
index d79a81a6d9..10eef05098 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
+++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
@@ -2,7 +2,7 @@
This is an example of how a driver might export data to the HII protocol to be
later utilized by the Setup Protocol
-Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -1981,25 +1981,40 @@ DriverSampleInit (
sizeof (DRIVER_SAMPLE_CONFIGURATION),
Configuration
);
- ASSERT (Status == EFI_SUCCESS);
+ if (EFI_ERROR (Status)) {
+ DriverSampleUnload (ImageHandle);
+ return Status;
+ }
//
// EFI variable for NV config doesn't exit, we should build this variable
// based on default values stored in IFR
//
ActionFlag = HiiSetToDefaults (NameRequestHdr, EFI_HII_DEFAULT_CLASS_STANDARD);
- ASSERT (ActionFlag);
+ if (!ActionFlag) {
+ DriverSampleUnload (ImageHandle);
+ return EFI_INVALID_PARAMETER;
+ }
ActionFlag = HiiSetToDefaults (ConfigRequestHdr, EFI_HII_DEFAULT_CLASS_STANDARD);
- ASSERT (ActionFlag);
+ if (!ActionFlag) {
+ DriverSampleUnload (ImageHandle);
+ return EFI_INVALID_PARAMETER;
+ }
} else {
//
// EFI variable does exist and Validate Current Setting
//
ActionFlag = HiiValidateSettings (NameRequestHdr);
- ASSERT (ActionFlag);
+ if (!ActionFlag) {
+ DriverSampleUnload (ImageHandle);
+ return EFI_INVALID_PARAMETER;
+ }
ActionFlag = HiiValidateSettings (ConfigRequestHdr);
- ASSERT (ActionFlag);
+ if (!ActionFlag) {
+ DriverSampleUnload (ImageHandle);
+ return EFI_INVALID_PARAMETER;
+ }
}
FreePool (ConfigRequestHdr);
@@ -2025,19 +2040,28 @@ DriverSampleInit (
sizeof (MY_EFI_VARSTORE_DATA),
VarStoreConfig
);
- ASSERT (Status == EFI_SUCCESS);
+ if (EFI_ERROR (Status)) {
+ DriverSampleUnload (ImageHandle);
+ return Status;
+ }
//
// EFI variable for NV config doesn't exit, we should build this variable
// based on default values stored in IFR
//
ActionFlag = HiiSetToDefaults (ConfigRequestHdr, EFI_HII_DEFAULT_CLASS_STANDARD);
- ASSERT (ActionFlag);
+ if (!ActionFlag) {
+ DriverSampleUnload (ImageHandle);
+ return EFI_INVALID_PARAMETER;
+ }
} else {
//
// EFI variable does exist and Validate Current Setting
//
ActionFlag = HiiValidateSettings (ConfigRequestHdr);
- ASSERT (ActionFlag);
+ if (!ActionFlag) {
+ DriverSampleUnload (ImageHandle);
+ return EFI_INVALID_PARAMETER;
+ }
}
FreePool (ConfigRequestHdr);