On 01/15/19 07:16, Zeng, Star wrote:
> On 2019/1/15 14:01, Wang, Jian J wrote:
>> Hi Star,
>>
>> Just two minor comments below.
>>
>>> -----Original Message-----
>>> From: Zeng, Star
>>> Sent: Monday, January 14, 2019 11:20 PM
>>> To: edk2-devel@lists.01.org
>>> Cc: Zeng, Star <star.z...@intel.com>; Wang, Jian J
>>> <jian.j.w...@intel.com>;
>>> Wu, Hao A <hao.a...@intel.com>; Kinney, Michael D
>>> <michael.d.kin...@intel.com>; Gao, Liming <liming....@intel.com>; Ni,
>>> Ray
>>> <ray...@intel.com>; Laszlo Ersek <ler...@redhat.com>; Ard Biesheuvel
>>> <ard.biesheu...@linaro.org>
>>> Subject: [PATCH V2 08/15] MdeModulePkg Variable: Add emulated
>>> variable NV
>>> mode support

>>> @@ -3894,9 +4024,19 @@ InitNonVolatileVariableStore (
>>>     UINTN                                 VariableSize;
>>>     EFI_STATUS                            Status;
>>>
>>> -  Status = InitRealNonVolatileVariableStore (&VariableStoreBase);
>>> -  if (EFI_ERROR (Status)) {
>>> -    return Status;
>>> +  if (!PcdGetBool (PcdEmuVariableNvModeEnable)) {
>>> +    Status = InitRealNonVolatileVariableStore (&VariableStoreBase);
>>> +    if (EFI_ERROR (Status)) {
>>> +      return Status;
>>> +    }
>>> +    mVariableModuleGlobal->VariableGlobal.EmuNvMode = FALSE;
>>> +  } else {
>>> +    Status = InitEmuNonVolatileVariableStore (&VariableStoreBase);
>>> +    if (EFI_ERROR (Status)) {
>>> +      return Status;
>>> +    }
>>> +    mVariableModuleGlobal->VariableGlobal.EmuNvMode = TRUE;
>>> +    DEBUG ((DEBUG_INFO, "Variable driver will work at emulated
>>> non-volatile
>>> variable mode!\n"));
>>>     }
>>>
>>
>> The logic is not wrong, just the if/else style might cause confusion at
>> the first glance. Swapping the if/else might let the code more clear.
>>
>> if (PcdGetBool (PcdEmuVariableNvModeEnable)) {
>>     ...initialize emulated variable store...
>> } else {
>>     ...initialize the real nv variable store...
>> }
> 
> I am neutral about it. I can update it if no other comment.

I agree with Jian: the change that he suggests does not complicate the
patch, and the end result is slightly more readable.

Thanks
Laszlo
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to