diff mbox

[RFC] arm-trusted-firmware: Fixup fastboot getvar hang on unknown var

Message ID 1452205492-4598-1-git-send-email-john.stultz@linaro.org
State New
Headers show

Commit Message

John Stultz Jan. 7, 2016, 10:24 p.m. UTC
The fastboot implementation doesn't return an error if queried for
a varable it doesn't know. This results in host's fastboot hanging
if it tries to query for an unsupported variable.

This patch addresses this by returning an error in the case
that the var is unkonwn.

(I've never touched this code before, so while this seems to work,
careful review would be appreciated.)

Cc: Dmitry Shmidt <dimitrysh@google.com>
Cc: Haojian Zhuang <haojian.zhuang@linaro.org>
Cc: Vishal Bhoj <vishal.bhoj@linaro.org>
Cc: Guodong Xu <guodong.xu@linaro.org>
Cc: Scott Bambrough <scott.bambrough@linaro.org>
Cc: Tom Gall <tom.gall@linaro.org>
Cc: Christian Bejram <cbejram@google.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>

---
 plat/hikey/usb.c | 6 ++++++
 1 file changed, 6 insertions(+)

-- 
1.9.1
diff mbox

Patch

diff --git a/plat/hikey/usb.c b/plat/hikey/usb.c
index 538912f..2184bec 100644
--- a/plat/hikey/usb.c
+++ b/plat/hikey/usb.c
@@ -1248,6 +1248,12 @@  static void fb_getvar(char *cmdbuf)
 		response[bytes] = '\0';
 		tx_status(response);
 		rx_cmd();
+	} else {
+		bytes = sprintf(response, "FAIL%s",
+					"unknown var");
+		response[bytes] = '\0';
+		tx_status(response);
+		rx_cmd();
 	}
 }