On Mon, 29 Apr 2024 at 03:17, Chao Li <lic...@loongson.cn> wrote:
>
> Hi Ard and Gerd and other maintainers,
>
> Could you review this version and give your suggestions?
>

This looks ok to me now, modulo a few minor tweaks (see below) that I
will apply when merging.

I also changed the type signatures to

extern
VOID
(EFIAPI *InternalQemuFwCfgReadBytes) (
  IN UINTN  Size,
  IN VOID   *Buffer  OPTIONAL
  );

Note that the EFIAPI applies to the function itself, not the pointer
so it needs to be inside the ()



--- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgMmioPei.c
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgMmioPei.c
@@ -104,7 +104,6 @@ QemuFwCfgInitialize (
   UINT64                FwCfgDmaAddress;
   UINT64                FwCfgDmaSize;
   QEMU_FW_CFG_RESOURCE  *FwCfgResource;
-  VOID                  *Buffer;

   //
   // Check whether the Qemu firmware configure resources HOB has been created,
@@ -125,11 +124,8 @@ QemuFwCfgInitialize (
   //
   // Create resouce memory
   //
-  Buffer = AllocatePages(EFI_SIZE_TO_PAGES (sizeof (QEMU_FW_CFG_RESOURCE)));
-  ASSERT (Buffer != NULL);
-  ZeroMem (Buffer, sizeof (QEMU_FW_CFG_RESOURCE));
-
-  FwCfgResource = (QEMU_FW_CFG_RESOURCE *)Buffer;
+  FwCfgResource = AllocateZeroPool (sizeof (QEMU_FW_CFG_RESOURCE));
+  ASSERT (FwCfgResource != NULL);

   for (Prev = 0; ; Prev = Node) {
     Node = fdt_next_node (DeviceTreeBase, Prev, NULL);
@@ -141,7 +137,7 @@ QemuFwCfgInitialize (
     // Check for memory node
     //
     Type = fdt_getprop (DeviceTreeBase, Node, "compatible", &Len);
-    if ((Type) &&
+    if ((Type != NULL) &&
         (AsciiStrnCmp (Type, "qemu,fw-cfg-mmio", Len) == 0))
     {
       //


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#118376): https://edk2.groups.io/g/devel/message/118376
Mute This Topic: https://groups.io/mt/105746786/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to