[PATCH] env: mmc: specify that the address is a block address when erasing
Quentin Schulz
foss+uboot at 0leil.net
Fri Jun 27 16:04:29 CEST 2025
From: Quentin Schulz <quentin.schulz at cherry.de>
I got very confused by the address printed when erasing the environment
because I clearly didn't remember setting it at that location.
It turns out, it's the block offset and not the byte offset that is
reported, so let's make this a bit more obvious to the user.
Signed-off-by: Quentin Schulz <quentin.schulz at cherry.de>
---
Another option would be to report the byte offset by multiplying
blk_start by desc->blksz I guess. The result needs to be stored in a u64
though instead of uint otherwise we'll be limited to 4GiB offset (which
should be fine in most cases but eh).
---
env/mmc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/env/mmc.c b/env/mmc.c
index 8848371eb4f5df58da2be5398f159fdd0a00da21..f16926dc74c594b15f0bc82301aa89e1d4456d59 100644
--- a/env/mmc.c
+++ b/env/mmc.c
@@ -383,7 +383,7 @@ static inline int erase_env(struct mmc *mmc, unsigned long size,
blk_cnt = ALIGN(size, erase_size) / desc->blksz;
n = blk_derase(desc, blk_start, blk_cnt);
- printf("%d blocks erased at 0x%x: %s\n", n, blk_start,
+ printf("%d blocks erased starting from block at 0x%x: %s\n", n, blk_start,
(n == blk_cnt) ? "OK" : "ERROR");
return (n == blk_cnt) ? 0 : 1;
---
base-commit: 359e3012921f2fc2d43f3c4e320a752173f82b82
change-id: 20250627-env-mmc-erase-blk-7a46a3e63c78
Best regards,
--
Quentin Schulz <quentin.schulz at cherry.de>
More information about the U-Boot
mailing list