[PATCH] hv: compile out unused function if CONFIG_MULTIBOOT2 is disabled


Calvin Zhang <calvinzhang.cool@...>
 

When CONFIG_MULTIBOOT2 is disabled, 'create_service_vm_efi_mmap_desc' is
unused and build fails becuase [-Werror=unused-function] is set.

boot/guest/bzimage_loader.c:188:17: error: 'create_service_vm_efi_mmap_desc' defined but not used [-Werror=unused-function]
188 | static uint16_t create_service_vm_efi_mmap_desc(struct acrn_vm *vm, struct efi_memory_desc *efi_mmap_desc)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Tracked-On: #7634
Signed-off-by: Calvin Zhang <calvinzhang.cool@...>
---
hypervisor/boot/guest/bzimage_loader.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/hypervisor/boot/guest/bzimage_loader.c b/hypervisor/boot/guest/bzimage_loader.c
index a05f2a176..d55519657 100644
--- a/hypervisor/boot/guest/bzimage_loader.c
+++ b/hypervisor/boot/guest/bzimage_loader.c
@@ -182,6 +182,7 @@ static void *get_bzimage_kernel_load_addr(struct acrn_vm *vm)
return load_addr;
}

+#ifdef CONFIG_MULTIBOOT2
/**
* @pre vm != NULL && efi_mmap_desc != NULL
*/
@@ -234,6 +235,7 @@ static uint16_t create_service_vm_efi_mmap_desc(struct acrn_vm *vm, struct efi_m

return desc_idx;
}
+#endif

/**
* @pre zp != NULL && vm != NULL
--
2.30.2

Join acrn-dev@lists.projectacrn.org to automatically receive all group messages.