diff options
author | Patrick Delaunay <patrick.delaunay@st.com> | 2020-06-15 10:38:56 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-07-26 14:35:30 -0400 |
commit | 76b640c3f2c7299acc5f1e89f8788862667cc5a0 (patch) | |
tree | 8ec03be51f81fafc40ff9e93deae58c16bd980e4 /env | |
parent | 2b2f727500dc934ce201f1445c94c540ecae2798 (diff) | |
download | u-boot-76b640c3f2c7299acc5f1e89f8788862667cc5a0.tar.gz u-boot-76b640c3f2c7299acc5f1e89f8788862667cc5a0.tar.bz2 u-boot-76b640c3f2c7299acc5f1e89f8788862667cc5a0.zip |
env: mmc: correct the offset returned by mmc_offset_try_partition
The output of the function mmc_offset_try_partition must be a
byte offset in mmc and not a multiple of blksz.
This function is used in mmc_offset(), called by mmc_get_env_addr()
and the offset is used in write_env(), erase_env() and read_env().
In these function, blk_start = offset / mmc->read_bl_len
or /write_bl_len so this offset is not a multiple of blksz.
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Diffstat (limited to 'env')
-rw-r--r-- | env/mmc.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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; } |