summaryrefslogtreecommitdiff
path: root/src/lib/bmp_logo.c
diff options
context:
space:
mode:
authorSubrata Banik <subratabanik@google.com>2024-04-02 08:00:14 +0000
committerSubrata Banik <subratabanik@google.com>2024-04-06 04:31:50 +0000
commit9c4d85d83af20b7e83ebcb577cd3566619abd545 (patch)
tree383e9d2a4ec05c872b03226e7a5ca9eb869f510e /src/lib/bmp_logo.c
parent49437a6945d039bf5c39eef883d42cb63559b79e (diff)
lib: Refactor bmp_load_logo() implementation
This refactoring ensures bmp_load_logo() takes logo_size as an argument, returning a valid logo_ptr only if logo_size is non-zero. This prevents potential errors from mismatched size assumption. BUG=b:242829490 TEST=google/rex0 builds successfully. Change-Id: I14bc54670a67980ec93bc366b274832d1f959e50 Signed-off-by: Subrata Banik <subratabanik@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/81618 Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Dinesh Gehlot <digehlot@google.com> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'src/lib/bmp_logo.c')
-rw-r--r--src/lib/bmp_logo.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/lib/bmp_logo.c b/src/lib/bmp_logo.c
index 288877780a..becb605645 100644
--- a/src/lib/bmp_logo.c
+++ b/src/lib/bmp_logo.c
@@ -16,25 +16,27 @@ const char *bmp_logo_filename(void)
}
#endif
-void bmp_load_logo(uint32_t *logo_ptr, uint32_t *logo_size)
+void *bmp_load_logo(size_t *logo_size)
{
void *logo_buffer;
/* CBMEM is locked for S3 resume path. */
if (acpi_is_wakeup_s3())
- return;
+ return NULL;
logo_entry = cbmem_entry_add(CBMEM_ID_FSP_LOGO, 1 * MiB);
if (!logo_entry)
- return;
+ return NULL;
logo_buffer = cbmem_entry_start(logo_entry);
if (!logo_buffer)
- return;
+ return NULL;
*logo_size = cbfs_load(bmp_logo_filename(), logo_buffer, 1 * MiB);
- if (*logo_size)
- *logo_ptr = (uintptr_t)logo_buffer;
+ if (*logo_size == 0)
+ return NULL;
+
+ return logo_buffer;
}
void bmp_release_logo(void)