diff options
author | Anton Staaf <robotboy@chromium.org> | 2011-09-02 13:45:28 +0000 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2011-09-07 23:39:36 +0200 |
commit | 155cfb5ef18731a6d761edd2169699c67f0e1306 (patch) | |
tree | cabc780527139333e622b50ef0903efc672354fb /include | |
parent | 49ea2e342b6b9c35623915125e4e0af734cfa594 (diff) | |
download | u-boot-imx-155cfb5ef18731a6d761edd2169699c67f0e1306.zip u-boot-imx-155cfb5ef18731a6d761edd2169699c67f0e1306.tar.gz u-boot-imx-155cfb5ef18731a6d761edd2169699c67f0e1306.tar.bz2 |
common: fix behavior of ROUND macro when input is already rounded
Currently when you call ROUND with a value that is already a
multiple of the second parameter it will return a value that is
one multiple larger, instead of returning the value passed in.
There are only two types of usage of ROUND currently, one in
various config files to round CONFIG_SYS_MALLOC_LEN to a multiple
of 4096 bytes. The other in cmd_sf.c where the incorrect behavior
of ROUND is worked around be subtracting one from the length argument
before passing it to ROUND.
This patch fixes ROUND and removes the workaround from cmd_sf. It
also results in all of the malloc pools that use ROUND to compute
their size shrinking by 4KB.
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/common.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/common.h b/include/common.h index bd10f31..af8b154 100644 --- a/include/common.h +++ b/include/common.h @@ -760,7 +760,7 @@ int cpu_release(int nr, int argc, char * const argv[]); #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) -#define ROUND(a,b) (((a) + (b)) & ~((b) - 1)) +#define ROUND(a,b) (((a) + (b) - 1) & ~((b) - 1)) #define DIV_ROUND(n,d) (((n) + ((d)/2)) / (d)) #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) |