]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
tool: use ALIGN() to align the size
authorKever Yang <kever.yang@rock-chips.com>
Mon, 30 Mar 2020 03:56:22 +0000 (11:56 +0800)
committerTom Rini <trini@konsulko.com>
Fri, 24 Apr 2020 14:10:00 +0000 (10:10 -0400)
Use the ALIGN() for size align so that the code is more readable.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
tools/fit_image.c
tools/socfpgaimage.c

index 4301b5decbba182821f7b9a01783111813c091fe..55efe12eeb8356fa2f12ae47df197c71e27e3ad9 100644 (file)
@@ -547,7 +547,7 @@ static int fit_import_data(struct image_tool_params *params, const char *fname)
        if (fd < 0)
                return -EIO;
        fit_size = fdt_totalsize(old_fdt);
-       data_base = (fit_size + 3) & ~3;
+       data_base = ALIGN(fit_size, 4);
 
        /* Allocate space to hold the new FIT */
        size = sbuf.st_size + 16384;
index 8fa098338b24a20924c2af6206cce1a26169ff7f..6dfd64e31dd5487eea58d8077f42ee38baa363e8 100644 (file)
@@ -203,7 +203,7 @@ static int sfp_sign_buffer(uint8_t *buf, uint8_t ver, uint8_t flags,
        uint32_t calc_crc;
 
        /* Align the length up */
-       len = (len + 3) & ~3;
+       len = ALIGN(len, 4);
 
        /* Build header, adding 4 bytes to length to hold the CRC32. */
        sfp_build_header(buf + HEADER_OFFSET, ver, flags, len + 4);