mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-10 17:41:54 +00:00
flash: Fix bad check for flash_is_erased()
This caused all platforms to check only the first 25% of each page to see if it's already erased. Fortunately, we tend to fill flash pages from the beginning, so in normal usage we don't hit this bug. BUG=chrome-os-partner:30281 BRANCH=all (if convenient) TEST=Make sure CONFIG_CMD_FLASH is defined. Then at the EC console: flasherase 0x1f000 0x400 rw 0x1f3e0 -> 0xffffffff flashwrite 0x1f3e0 0x20 rw 0x1f3e0 -> 0x03020100 flasherase 0x1f000 0x400 rw 0x1f3e0 -> 0x03020100 (bad!) or 0xffffffff (good) Change-Id: If78b08b5e0414993a440bc8cd707b5ce70eb1a0a Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/206891 Reviewed-by: Dmitry Torokhov <dtor@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
This commit is contained in:
committed by
chrome-internal-fetch
parent
66f4c2e700
commit
2c4432f609
@@ -120,7 +120,7 @@ int flash_is_erased(uint32_t offset, int size)
|
||||
(const char **)&ptr) < 0)
|
||||
return 0;
|
||||
|
||||
for (size /= sizeof(uint32_t); size > 0; size -= 4, ptr++)
|
||||
for (size /= sizeof(uint32_t); size > 0; size--, ptr++)
|
||||
if (*ptr != CONFIG_FLASH_ERASED_VALUE32)
|
||||
return 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user