mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-19 05:31:32 +00:00
gpio: check request result
Make sure the pin request passed before attempting to use it later on. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
parent
f93c25966f
commit
6801201ee7
1 changed files with 4 additions and 1 deletions
|
@ -57,7 +57,10 @@ static int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||||
goto show_usage;
|
goto show_usage;
|
||||||
|
|
||||||
/* grab the pin before we tweak it */
|
/* 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 */
|
/* finally, let's do it: set direction and exec command */
|
||||||
if (sub_cmd == GPIO_INPUT) {
|
if (sub_cmd == GPIO_INPUT) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue