Message ID | 20200330035625.25164-6-kever.yang@rock-chips.com |
---|---|
State | Accepted |
Commit | 02560b13689650cf0d2f5825eaf480629ce9238f |
Delegated to: | Tom Rini |
Headers | show |
Series | [v4,1/8] tool: Move ALIGN_MASK to header as common MACRO | expand |
On Mon, Mar 30, 2020 at 11:56:22AM +0800, Kever Yang wrote: > 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> Applied to u-boot/master, thanks!
diff --git a/tools/fit_image.c b/tools/fit_image.c index dd61a816c9..b7d615f8c8 100644 --- a/tools/fit_image.c +++ b/tools/fit_image.c @@ -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; diff --git a/tools/socfpgaimage.c b/tools/socfpgaimage.c index 8fa098338b..6dfd64e31d 100644 --- a/tools/socfpgaimage.c +++ b/tools/socfpgaimage.c @@ -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);