]> git.baikalelectronics.ru Git - uboot.git/commitdiff
image: fit: Use stack allocation macro
authorJoel Stanley <joel@jms.id.au>
Mon, 20 Jun 2022 07:01:17 +0000 (16:31 +0930)
committerTom Rini <trini@konsulko.com>
Fri, 1 Jul 2022 20:01:25 +0000 (16:01 -0400)
The documentation above the DEFINE_ALIGN_BUFFER says it's for use
outside functions, but we're inside one.

Instead use ALLOC_CACHE_ALIGN_BUFFER, the stack based macro, which also
includes the cache alignment.

Fixes: 4ec8564f5550 ("image: fit: Align hash output buffers")
Signed-off-by: Joel Stanley <joel@jms.id.au>
Tested-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
Reviewed-by: Sean Anderson <sean.anderson@seco.com>
boot/image-fit.c
tools/mkimage.h

index f57d97f552295587f088e21fa42c63687653c58c..df3e5df8836a78f328b74453d5d27de33397a3d3 100644 (file)
@@ -1264,8 +1264,7 @@ int calculate_hash(const void *data, int data_len, const char *name,
 static int fit_image_check_hash(const void *fit, int noffset, const void *data,
                                size_t size, char **err_msgp)
 {
-       DEFINE_ALIGN_BUFFER(uint8_t, value, FIT_MAX_HASH_LEN,
-                           ARCH_DMA_MINALIGN);
+       ALLOC_CACHE_ALIGN_BUFFER(uint8_t, value, FIT_MAX_HASH_LEN);
        int value_len;
        const char *algo;
        uint8_t *fit_value;
index 7652c8b001c3f335115e6e0ccf7e02d3f97bf50e..f5ca65e2edfd78a1869e1bcdf2a2a62e1fd08c55 100644 (file)
@@ -41,8 +41,7 @@ static inline ulong map_to_sysmem(void *ptr)
        return (ulong)(uintptr_t)ptr;
 }
 
-#define ARCH_DMA_MINALIGN 1
-#define DEFINE_ALIGN_BUFFER(type, name, size, alugn) type name[size]
+#define ALLOC_CACHE_ALIGN_BUFFER(type, name, size) type name[size]
 
 #define MKIMAGE_TMPFILE_SUFFIX         ".tmp"
 #define MKIMAGE_MAX_TMPFILE_LEN                256