All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kever Yang <kever.yang@rock-chips.com>
To: u-boot@lists.denx.de
Subject: [PATCH v4 6/8] tool: use ALIGN() to align the size
Date: Mon, 30 Mar 2020 11:56:22 +0800	[thread overview]
Message-ID: <20200330035625.25164-6-kever.yang@rock-chips.com> (raw)
In-Reply-To: <20200330035625.25164-1-kever.yang@rock-chips.com>

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>
---

Changes in v4: None
Changes in v3: None
Changes in v2: None

 tools/fit_image.c    | 2 +-
 tools/socfpgaimage.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

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);
-- 
2.17.1

  parent reply	other threads:[~2020-03-30  3:56 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-30  3:56 [PATCH v4 1/8] tool: Move ALIGN_MASK to header as common MACRO Kever Yang
2020-03-30  3:56 ` [PATCH v4 2/8] tool: aisimage: use ALIGN instead of self defiend macro Kever Yang
2020-04-24 17:09   ` Tom Rini
2020-03-30  3:56 ` [PATCH v4 3/8] tools: mkimage: use common ALIGN to do the size align Kever Yang
2020-04-24 17:09   ` Tom Rini
2020-03-30  3:56 ` [PATCH v4 4/8] tools: kwbimage: " Kever Yang
2020-04-24 17:09   ` Tom Rini
2020-03-30  3:56 ` [PATCH v4 5/8] tools: imx8mimage: remove redundant code Kever Yang
2020-04-24 17:10   ` Tom Rini
2020-03-30  3:56 ` Kever Yang [this message]
2020-04-24 17:10   ` [PATCH v4 6/8] tool: use ALIGN() to align the size Tom Rini
2020-03-30  3:56 ` [PATCH v4 7/8] libfdt: Make fdtdec_get_child_count() available for HOST Kever Yang
2020-03-30  5:29   ` Heinrich Schuchardt
2020-03-30  6:29     ` Kever Yang
2020-03-30  8:07       ` Heinrich Schuchardt
2020-03-30 23:57   ` Simon Glass
2020-04-24 17:10   ` Tom Rini
2020-03-30  3:56 ` [PATCH v4 8/8] mkimage: fit_image: Add option to make fit header align Kever Yang
2020-03-30 23:30   ` Tom Rini
2020-04-24  6:52     ` Kever Yang
2020-04-24 17:10   ` Tom Rini
2020-04-24 17:09 ` [PATCH v4 1/8] tool: Move ALIGN_MASK to header as common MACRO Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200330035625.25164-6-kever.yang@rock-chips.com \
    --to=kever.yang@rock-chips.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.