Skip to content

Commit

Permalink
BlockVariable: flush variable twice
Browse files Browse the repository at this point in the history
If it's the last flush operation, variable may not be flushed into the
block device. So flush it twice. It could make sure that everything is
flushed into block device.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
  • Loading branch information
hzhuang1 committed Apr 7, 2015
1 parent 6f8ffb6 commit cbf165c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions HisiPkg/HiKeyPkg/Drivers/BlockVariableDxe/BlockVariableDxe.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,14 @@ FvbWrite (
DEBUG ((EFI_D_ERROR, "FvbWrite StartLba:%x, Lba:%x, Offset:%x, Status:%x\n",
Instance->StartLba, Lba, Offset, Status));
}
// Sometimes the variable isn't flushed into block device if it's the last flush operation.
// So flush it again.
Status = BlockIo->WriteBlocks (BlockIo, BlockIo->Media->MediaId, Instance->StartLba + Lba,
Bytes, DataPtr);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "FvbWrite StartLba:%x, Lba:%x, Offset:%x, Status:%x\n",
Instance->StartLba, Lba, Offset, Status));
}
exit:
FreePool (DataPtr);
return Status;
Expand Down

0 comments on commit cbf165c

Please sign in to comment.