summaryrefslogtreecommitdiff
path: root/env/mmc.c
diff options
context:
space:
mode:
Diffstat (limited to 'env/mmc.c')
-rw-r--r--env/mmc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/env/mmc.c b/env/mmc.c
index e67ef90bce..5de4a45817 100644
--- a/env/mmc.c
+++ b/env/mmc.c
@@ -56,10 +56,10 @@ static inline int mmc_offset_try_partition(const char *str, s64 *val)
}
/* round up to info.blksz */
- len = (CONFIG_ENV_SIZE + info.blksz - 1) & ~(info.blksz - 1);
+ len = DIV_ROUND_UP(CONFIG_ENV_SIZE, info.blksz);
/* use the top of the partion for the environment */
- *val = (info.start + info.size - 1) - len / info.blksz;
+ *val = (info.start + info.size - len) * info.blksz;
return 0;
}