From 155cfb5ef18731a6d761edd2169699c67f0e1306 Mon Sep 17 00:00:00 2001 From: Anton Staaf Date: Fri, 2 Sep 2011 13:45:28 +0000 Subject: 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 Cc: Mike Frysinger --- common/cmd_sf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common') diff --git a/common/cmd_sf.c b/common/cmd_sf.c index 11a491df76..27d6e39a18 100644 --- a/common/cmd_sf.c +++ b/common/cmd_sf.c @@ -53,7 +53,7 @@ static int sf_parse_len_arg(char *arg, ulong *len) return -1; if (round_up_len && flash->sector_size > 0) - *len = ROUND(len_arg - 1, flash->sector_size); + *len = ROUND(len_arg, flash->sector_size); else *len = len_arg; -- cgit