From e65500338427b64e83a59432242a1ef295dd95f0 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 18 Oct 2022 06:46:08 -0600 Subject: video: Rename CONFIG_SYS_VIDEO_LOGO_MAX_SIZE This option should not have the SYS_ in it. Drop it so it fits in with the other video options. Also simplify the alignment code in gunzip_bmp(), since malloc() always returns a 32-bit-aligned pointer. Signed-off-by: Simon Glass --- cmd/bmp.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'cmd/bmp.c') diff --git a/cmd/bmp.c b/cmd/bmp.c index d72a826ae74..5a3c8ddf8c8 100644 --- a/cmd/bmp.c +++ b/cmd/bmp.c @@ -48,27 +48,24 @@ struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp, /* * Decompress bmp image */ - len = CONFIG_SYS_VIDEO_LOGO_MAX_SIZE; + len = CONFIG_VIDEO_LOGO_MAX_SIZE; /* allocate extra 3 bytes for 32-bit-aligned-address + 2 alignment */ - dst = malloc(CONFIG_SYS_VIDEO_LOGO_MAX_SIZE + 3); - if (dst == NULL) { + dst = malloc(CONFIG_VIDEO_LOGO_MAX_SIZE + 3); + if (!dst) { puts("Error: malloc in gunzip failed!\n"); return NULL; } - bmp = dst; - /* align to 32-bit-aligned-address + 2 */ - bmp = (struct bmp_image *)((((uintptr_t)dst + 1) & ~3) + 2); + bmp = dst + 2; - if (gunzip(bmp, CONFIG_SYS_VIDEO_LOGO_MAX_SIZE, map_sysmem(addr, 0), - &len) != 0) { + if (gunzip(bmp, CONFIG_VIDEO_LOGO_MAX_SIZE, map_sysmem(addr, 0), + &len)) { free(dst); return NULL; } - if (len == CONFIG_SYS_VIDEO_LOGO_MAX_SIZE) - puts("Image could be truncated" - " (increase CONFIG_SYS_VIDEO_LOGO_MAX_SIZE)!\n"); + if (len == CONFIG_VIDEO_LOGO_MAX_SIZE) + puts("Image could be truncated (increase CONFIG_VIDEO_LOGO_MAX_SIZE)!\n"); /* * Check for bmp mark 'BM' -- cgit v1.2.3