Felix Singer has submitted this change. ( https://review.coreboot.org/c/flashrom/+/67725 )
(
6 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: cli_classic.c: Add error messages for invalid --wp-region use ......................................................................
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 --- M cli_classic.c 1 file changed, 29 insertions(+), 2 deletions(-)
Approvals: build bot (Jenkins): Verified Felix Singer: Looks good to me, approved
diff --git a/cli_classic.c b/cli_classic.c index bac31d1..3de0020 100644 --- a/cli_classic.c +++ b/cli_classic.c @@ -1110,9 +1110,17 @@
if (any_wp_op) { if (set_wp_region && wp_region) { - ret = flashrom_layout_get_region_range(layout, wp_region, &wp_start, &wp_len); - if (ret) + 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) { + msg_gerr("Error: Region %s not found in flash layout.\n", wp_region); + goto out_release; + } set_wp_range = true; } ret = wp_cli(