SHELL_STATUS ShellStatus;\r
\r
ASSERT (FilePath != NULL);\r
+ DevicePath = NULL;\r
TextDevicePath = NULL;\r
FdtVariableValue = NULL;\r
\r
- DevicePath = Shell->GetDevicePathFromFilePath (FilePath);\r
- if (DevicePath != NULL) {\r
- Status = gBS->LocateProtocol (\r
- &gEfiDevicePathToTextProtocolGuid,\r
- NULL,\r
- (VOID **)&EfiDevicePathToTextProtocol\r
- );\r
- if (EFI_ERROR (Status)) {\r
- goto Error;\r
- }\r
+ if (*FilePath != L'\0') {\r
+ DevicePath = Shell->GetDevicePathFromFilePath (FilePath);\r
+ if (DevicePath != NULL) {\r
+ Status = gBS->LocateProtocol (\r
+ &gEfiDevicePathToTextProtocolGuid,\r
+ NULL,\r
+ (VOID **)&EfiDevicePathToTextProtocol\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ goto Error;\r
+ }\r
\r
- TextDevicePath = EfiDevicePathToTextProtocol->ConvertDevicePathToText (\r
- DevicePath,\r
- FALSE,\r
- FALSE\r
- );\r
- if (TextDevicePath == NULL) {\r
- Status = EFI_OUT_OF_RESOURCES;\r
- goto Error;\r
- }\r
- FdtVariableValue = TextDevicePath;\r
- } else {\r
- //\r
- // Try to convert back the EFI Device Path String into a EFI device Path\r
- // to ensure the format is valid\r
- //\r
- Status = gBS->LocateProtocol (\r
- &gEfiDevicePathFromTextProtocolGuid,\r
- NULL,\r
- (VOID **)&EfiDevicePathFromTextProtocol\r
- );\r
- if (EFI_ERROR (Status)) {\r
- goto Error;\r
- }\r
+ TextDevicePath = EfiDevicePathToTextProtocol->ConvertDevicePathToText (\r
+ DevicePath,\r
+ FALSE,\r
+ FALSE\r
+ );\r
+ if (TextDevicePath == NULL) {\r
+ Status = EFI_OUT_OF_RESOURCES;\r
+ goto Error;\r
+ }\r
+ FdtVariableValue = TextDevicePath;\r
+ } else {\r
+ //\r
+ // Try to convert back the EFI Device Path String into a EFI device Path\r
+ // to ensure the format is valid\r
+ //\r
+ Status = gBS->LocateProtocol (\r
+ &gEfiDevicePathFromTextProtocolGuid,\r
+ NULL,\r
+ (VOID **)&EfiDevicePathFromTextProtocol\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ goto Error;\r
+ }\r
\r
- DevicePath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath (\r
- FilePath\r
- );\r
- if (DevicePath == NULL) {\r
- Status = EFI_INVALID_PARAMETER;\r
- goto Error;\r
+ DevicePath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath (\r
+ FilePath\r
+ );\r
+ if (DevicePath == NULL) {\r
+ Status = EFI_INVALID_PARAMETER;\r
+ goto Error;\r
+ }\r
+ FdtVariableValue = (CHAR16*)FilePath;\r
}\r
- FdtVariableValue = (CHAR16*)FilePath;\r
}\r
\r
Status = gRT->SetVariable (\r
EFI_VARIABLE_RUNTIME_ACCESS |\r
EFI_VARIABLE_NON_VOLATILE |\r
EFI_VARIABLE_BOOTSERVICE_ACCESS ,\r
- StrSize (FdtVariableValue),\r
+ (FdtVariableValue != NULL) ?\r
+ StrSize (FdtVariableValue) : 0,\r
FdtVariableValue\r
);\r
\r
Error:\r
ShellStatus = EfiCodeToShellCode (Status);\r
if (!EFI_ERROR (Status)) {\r
- ShellPrintHiiEx (\r
- -1, -1, NULL,\r
- STRING_TOKEN (STR_SETFDT_UPDATE_SUCCEEDED),\r
- mFdtPlatformDxeHiiHandle,\r
- FdtVariableValue\r
- );\r
+ if (FdtVariableValue != NULL) {\r
+ ShellPrintHiiEx (\r
+ -1, -1, NULL,\r
+ STRING_TOKEN (STR_SETFDT_UPDATE_SUCCEEDED),\r
+ mFdtPlatformDxeHiiHandle,\r
+ FdtVariableValue\r
+ );\r
+ } else {\r
+ ShellPrintHiiEx (\r
+ -1, -1, NULL,\r
+ STRING_TOKEN (STR_SETFDT_UPDATE_DELETED),\r
+ mFdtPlatformDxeHiiHandle,\r
+ FdtVariableValue\r
+ );\r
+ }\r
} else {\r
if (Status == EFI_INVALID_PARAMETER) {\r
ShellPrintHiiEx (\r