diff options
author | Nikolai Artemiev <nartemiev@google.com> | 2022-09-20 15:45:34 +1000 |
---|---|---|
committer | Felix Singer <felixsinger@posteo.net> | 2022-09-30 00:29:09 +0000 |
commit | 7e8d17a8bd6e8239375666920b1824c4d24d4a01 (patch) | |
tree | 9d54d8fe2776f8f090127687ee86d02c00578183 /cli_classic.c | |
parent | ad0ee5c60662dff449d3fb4eb62b9e126fc54c9f (diff) | |
download | flashrom-7e8d17a8bd6e8239375666920b1824c4d24d4a01.tar.gz flashrom-7e8d17a8bd6e8239375666920b1824c4d24d4a01.tar.bz2 flashrom-7e8d17a8bd6e8239375666920b1824c4d24d4a01.zip |
cli_classic.c: Add error messages for invalid --wp-region use
Print errors if --wp-region is used without a layout file or the layout
file doesn't contain the region.
BUG=b:247055486
TEST=builds
Change-Id: Ie606ba7f8a423405099679ca62169c395d994b5d
Signed-off-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67725
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
Diffstat (limited to 'cli_classic.c')
-rw-r--r-- | cli_classic.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/cli_classic.c b/cli_classic.c index bac31d1c1..3de00206f 100644 --- a/cli_classic.c +++ b/cli_classic.c @@ -1110,9 +1110,17 @@ int main(int argc, char *argv[]) if (any_wp_op) { if (set_wp_region && wp_region) { + if (!layout) { + msg_gerr("Error: A flash layout must be specified to use --wp-region.\n"); + ret = 1; + goto out_release; + } + ret = flashrom_layout_get_region_range(layout, wp_region, &wp_start, &wp_len); - if (ret) + if (ret) { + msg_gerr("Error: Region %s not found in flash layout.\n", wp_region); goto out_release; + } set_wp_range = true; } ret = wp_cli( |