From 4a50ffc746227a9d180e7454128d28e63fac0d82 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Wed, 1 Apr 2015 18:14:11 +0200 Subject: imx-image: main: make use of round_up instead of open coding it Signed-off-by: Marc Kleine-Budde Signed-off-by: Sascha Hauer --- scripts/imx/imx-image.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/imx/imx-image.c b/scripts/imx/imx-image.c index 9928f40d05..1abbde202f 100644 --- a/scripts/imx/imx-image.c +++ b/scripts/imx/imx-image.c @@ -29,6 +29,7 @@ #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) #define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER) +#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) #define MAX_DCD 1024 #define HEADER_LEN 0x1000 /* length of the blank area + IVT + DCD */ @@ -739,7 +740,7 @@ int main(int argc, char *argv[]) * - i.MX6 SPI NOR boot corrupts the last few bytes of an image loaded * in ver funy ways when the image size is not 4 byte aligned */ - load_size = ((image_size + HEADER_LEN) + 0xfff) & ~0xfff; + load_size = roundup(image_size + HEADER_LEN, 0x1000); if (cpu_type == 35) load_size += HEADER_LEN; -- cgit v1.2.3