The two decompressors duplicate this call and the next patch needs to change the argument. Hoist it up to remove the duplication.
Signed-off-by: Jason Gunthorpe <[email protected]> --- drivers/firmware/efi/libstub/zboot-decompress-gzip.c | 2 -- drivers/firmware/efi/libstub/zboot-decompress-zstd.c | 2 -- drivers/firmware/efi/libstub/zboot.c | 9 ++++++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/firmware/efi/libstub/zboot-decompress-gzip.c b/drivers/firmware/efi/libstub/zboot-decompress-gzip.c index e97a7e9d3c980b..79cf8c48b03385 100644 --- a/drivers/firmware/efi/libstub/zboot-decompress-gzip.c +++ b/drivers/firmware/efi/libstub/zboot-decompress-gzip.c @@ -62,7 +62,5 @@ efi_status_t efi_zboot_decompress(u8 *out, unsigned long outlen) return EFI_LOAD_ERROR; } - efi_cache_sync_image((unsigned long)out, outlen); - return EFI_SUCCESS; } diff --git a/drivers/firmware/efi/libstub/zboot-decompress-zstd.c b/drivers/firmware/efi/libstub/zboot-decompress-zstd.c index bde9d94dd2e3ac..dd7f11238154e1 100644 --- a/drivers/firmware/efi/libstub/zboot-decompress-zstd.c +++ b/drivers/firmware/efi/libstub/zboot-decompress-zstd.c @@ -43,7 +43,5 @@ efi_status_t efi_zboot_decompress(u8 *out, unsigned long outlen) return EFI_LOAD_ERROR; } - efi_cache_sync_image((unsigned long)out, outlen); - return EFI_SUCCESS; } diff --git a/drivers/firmware/efi/libstub/zboot.c b/drivers/firmware/efi/libstub/zboot.c index 4b76f74c56dae0..960a542881d875 100644 --- a/drivers/firmware/efi/libstub/zboot.c +++ b/drivers/firmware/efi/libstub/zboot.c @@ -92,9 +92,12 @@ efi_zboot_entry(efi_handle_t handle, efi_system_table_t *systab) } // Decompress the payload into the newly allocated buffer - status = efi_zboot_decompress((void *)image_base, alloc_size) ?: - efi_stub_common(handle, image, image_base, cmdline_ptr); - + status = efi_zboot_decompress((void *)image_base, alloc_size); + if (status == EFI_SUCCESS) { + efi_cache_sync_image(image_base, alloc_size); + status = + efi_stub_common(handle, image, image_base, cmdline_ptr); + } efi_free(alloc_size, image_base); return status; } -- 2.43.0
