Skip to content
Snippets Groups Projects
Commit 6801201e authored by Mike Frysinger's avatar Mike Frysinger
Browse files

gpio: check request result


Make sure the pin request passed before attempting to use it later on.

Signed-off-by: default avatarMike Frysinger <vapier@gentoo.org>
parent f93c2596
No related branches found
No related tags found
No related merge requests found
......@@ -57,7 +57,10 @@ static int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
goto show_usage;
/* grab the pin before we tweak it */
gpio_request(gpio, "cmd_gpio");
if (gpio_request(gpio, "cmd_gpio")) {
printf("gpio: requesting pin %u failed\n", gpio);
return -1;
}
/* finally, let's do it: set direction and exec command */
if (sub_cmd == GPIO_INPUT) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment