1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-10-27 11:22:10 +01:00

Revert "flashrom.c: move can_change_target_regions check below wp unlock"

This reverts commit 3a6d88f438.

Reason: tests fail
[  FAILED  ] erase failure for unskipped unwritable regions
[  ERROR   ] --- Blocks allocated...
../libflashrom.c:631: note: block 0x55ede27e51e0 allocated here
ERROR: erase failure for unskipped unwritable regions leaked 1 block(s)

[  FAILED  ] full_chip_erase_with_wp_dummyflasher_test_success
[  ERROR   ] --- Blocks allocated...
../libflashrom.c:631: note: block 0x55ede27e3800 allocated here
../spi25_statusreg.c:312: note: block 0x55ede27e7380 allocated here
ERROR: full_chip_erase_with_wp_dummyflasher_test_success leaked 2 block(s)

Change-Id: I912dab51f7a471d098f6f265aa2582f4194b7b6b
Signed-off-by: Anastasia Klimchuk <aklm@flashrom.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/89753
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-by: Peter Marheine <pmarheine@chromium.org>
This commit is contained in:
Anastasia Klimchuk
2025-10-27 08:47:52 +11:00
parent 3a6d88f438
commit 8e0bfee62f

View File

@@ -1900,6 +1900,13 @@ int prepare_flash_access(struct flashctx *const flash,
return 1; return 1;
} }
if ((write_it || erase_it) && !flash->flags.force) {
if (!can_change_target_regions(flash)) {
msg_cerr("At least one target region is not fully writable. Aborting.\n");
return 1;
}
}
if (map_flash(flash) != 0) if (map_flash(flash) != 0)
return 1; return 1;
@@ -1923,13 +1930,6 @@ int prepare_flash_access(struct flashctx *const flash,
if (ret && bp_func) if (ret && bp_func)
bp_func(flash); bp_func(flash);
if ((write_it || erase_it) && !flash->flags.force) {
if (!can_change_target_regions(flash)) {
msg_cerr("At least one target region is not fully writable. Aborting.\n");
return 1;
}
}
flash->address_high_byte = -1; flash->address_high_byte = -1;
flash->in_4ba_mode = false; flash->in_4ba_mode = false;