From 3403e3cfb98d0c523ae9636c41fc41e063561e0a Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Wed, 17 Jun 2026 10:06:42 -0400 Subject: [PATCH] imxtools: Fix several build warnings Change-Id: Idebf0445d3e861ff27e152730c5bed64c2e4489b --- utils/imxtools/sbtools/rsrc.c | 3 ++- utils/imxtools/sbtools/rsrctool.c | 3 ++- utils/imxtools/sbtools/sb.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/utils/imxtools/sbtools/rsrc.c b/utils/imxtools/sbtools/rsrc.c index 965ada3856..3e42985ace 100644 --- a/utils/imxtools/sbtools/rsrc.c +++ b/utils/imxtools/sbtools/rsrc.c @@ -31,6 +31,7 @@ const char crypto_key[16] = "SanDiskSlotRadi"; +#if 0 static void rsrc_crypt(void *buf, int size) { if(size % 16) @@ -42,6 +43,7 @@ static void rsrc_crypt(void *buf, int size) p[j] ^= crypto_key[j]; } } +#endif enum rsrc_error_t rsrc_write_file(struct rsrc_file_t *rsrc, const char *filename) { @@ -252,4 +254,3 @@ void rsrc_dump(struct rsrc_file_t *file, void *u, rsrc_color_printf cprintf) #undef printf #undef print_hex } - diff --git a/utils/imxtools/sbtools/rsrctool.c b/utils/imxtools/sbtools/rsrctool.c index c5e743c3e0..fc5f38ddd0 100644 --- a/utils/imxtools/sbtools/rsrctool.c +++ b/utils/imxtools/sbtools/rsrctool.c @@ -37,7 +37,9 @@ #define PAD_TO_BOUNDARY(x) (((x) + 0x1ff) & ~0x1ff) /* If you find a firmware that breaks the known format ^^ */ +#ifndef assert #define assert(a) do { if(!(a)) { fprintf(stderr,"Assertion \"%s\" failed in %s() line %d!\n\nPlease send us your firmware!\n",#a,__func__,__LINE__); exit(1); } } while(0) +#endif #define crypto_cbc(...) \ do { int ret = crypto_cbc(__VA_ARGS__); \ @@ -198,4 +200,3 @@ int main(int argc, char **argv) return 0; } - diff --git a/utils/imxtools/sbtools/sb.c b/utils/imxtools/sbtools/sb.c index bc198c6895..47adf268cd 100644 --- a/utils/imxtools/sbtools/sb.c +++ b/utils/imxtools/sbtools/sb.c @@ -488,11 +488,11 @@ enum sb_error_t sb_write_file(struct sb_file_t *sb, const char *filename, void * if(buf_p - buf != sb_hdr.image_size * BLOCK_SIZE) { - free(buf); printf(GREY, "Internal error: SB image buffer was not entirely filled !\n"); printf(GREY, "Internal error: expected %u blocks, got %u\n", (buf_p - buf) / BLOCK_SIZE, sb_hdr.image_size); cprintf(u, true, GREY, "Internal error\n"); + free(buf); return SB_ERROR; }