firmware/2lib: Skip rest of ui_loop after closing error box

Previously, if we see an error box displayed on the screen, and we hit
return, not only will we exit the error box, but we will also process
the key (ie: return) on the background screen and advance to another
screen.  Correcting this by setting key to 0, thus skipping all the
actions on the background screen in ui_loop() after exiting the error
box.

BUG=b:144969091
BRANCH=puff
TEST=dut-control power_state:rec
     press ctrl-d
     press return
     make sure we exit the error box only and don't advanced to the
     next screen

Signed-off-by: Shelley Chen <shchen@google.com>
Change-Id: I64f67bb175b4a67a885b368334fb19f4cf288883
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2278925
Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
Tested-by: Shelley Chen <shchen@chromium.org>
Commit-Queue: Shelley Chen <shchen@chromium.org>
diff --git a/firmware/2lib/2ui.c b/firmware/2lib/2ui.c
index 9147862..23b7b0d 100644
--- a/firmware/2lib/2ui.c
+++ b/firmware/2lib/2ui.c
@@ -77,11 +77,14 @@
 vb2_error_t error_exit_action(struct vb2_ui_context *ui)
 {
 	/*
-	 * If the only difference is the error message, then just
-	 * redraw the screen without the error string.
+	 * If an error message is currently shown on the screen, any
+	 * key press clears that error.  Unset the key so that it is
+	 * not processed by other action functions.
 	 */
-	if (ui->key && ui->error_code != VB2_UI_ERROR_NONE)
+	if (ui->key && ui->error_code != VB2_UI_ERROR_NONE) {
 		ui->error_code = VB2_UI_ERROR_NONE;
+		ui->key = 0;
+	}
 	return VB2_REQUEST_UI_CONTINUE;
 }