summaryrefslogtreecommitdiff
path: root/zephyr/shim
diff options
context:
space:
mode:
authorTing Shen <phoenixshen@google.com>2023-01-16 15:36:07 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-01-16 11:18:49 +0000
commite36a0bf504f7e091e964a66d20d30b27e01fae57 (patch)
treef560046b944912f39f1ad1ec6b116fb32826230e /zephyr/shim
parent2821042a63da8310dcad5a2cdf2082fa56a4b25c (diff)
downloadchrome-ec-e36a0bf504f7e091e964a66d20d30b27e01fae57.tar.gz
flash: allow zero num_banks_desc in flash_info request
Some external tools (e.g. flashrom) sends EC_CMD_FLASH_INFO with num_banks_desc=0 to get the total number of banks. EC should allow this type of request. Also add a test to cover this use case. BUG=b:265472751 TEST=1) `flashrom -p ec -w <ec.bin>` on tentacruel 2) ./twister -T zephyr/test/drivers/ \ --sub-test drivers.flash.page_layout 3) ./twister -T zephyr/test/drivers/ --sub-test drivers.flash BRANCH=none Change-Id: Iab97ac754bac87067f949cf9435156be91b07ebc Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4167539 Tested-by: Chen-Tsung Hsieh <chentsung@chromium.org> Reviewed-by: Patryk Duda <patrykd@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Commit-Queue: Patryk Duda <patrykd@google.com>
Diffstat (limited to 'zephyr/shim')
-rw-r--r--zephyr/shim/src/flash.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/zephyr/shim/src/flash.c b/zephyr/shim/src/flash.c
index 53c79ec7cb..3c33bed4f4 100644
--- a/zephyr/shim/src/flash.c
+++ b/zephyr/shim/src/flash.c
@@ -321,9 +321,6 @@ int crec_flash_response_fill_banks(struct ec_response_flash_info_2 *r,
int banks_idx = 0;
int res;
- if (num_banks < 1)
- return EC_RES_INVALID_PARAM;
-
do {
res = flash_get_region(sector_idx, &region);
if (res != EC_RES_SUCCESS && res != EC_RES_IN_PROGRESS)