From 66280e82f7fe90194236da39ab0e2f42869a8070 Mon Sep 17 00:00:00 2001
From: Simon Glass <sjg@chromium.org>
Date: Thu, 21 Jan 2016 19:44:50 -0700
Subject: [PATCH] gpio: Warn about invalid GPIOs used with the 'gpio' command

At present there is no indication that an invalid GPIO is used except that
the GPIO status is not displayed. Make the error more explicit to avoid
confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 common/cmd_gpio.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/common/cmd_gpio.c b/common/cmd_gpio.c
index bb0f63a5924..2b78b168663 100644
--- a/common/cmd_gpio.c
+++ b/common/cmd_gpio.c
@@ -174,8 +174,10 @@ static int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	 * GPIO compatibility layer.
 	 */
 	ret = gpio_lookup_name(str_gpio, NULL, NULL, &gpio);
-	if (ret)
+	if (ret) {
+		printf("GPIO: '%s' not found\n", str_gpio);
 		return cmd_process_error(cmdtp, ret);
+	}
 #else
 	/* turn the gpio name into a gpio number */
 	gpio = name_to_gpio(str_gpio);
-- 
GitLab