summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-04-12 03:02:11 -0400
committerMike Frysinger <vapier@gentoo.org>2011-04-13 15:57:00 -0400
commit6801201ee72795dddb1e23aa6091c95866b19e0b (patch)
tree8ca09890bc6c664dece54d6eeea6d9c2806a6bc8 /common
parentf93c25966f7f5a9696b1dbc304ebe953040e08b3 (diff)
downloadu-boot-imx-6801201ee72795dddb1e23aa6091c95866b19e0b.zip
u-boot-imx-6801201ee72795dddb1e23aa6091c95866b19e0b.tar.gz
u-boot-imx-6801201ee72795dddb1e23aa6091c95866b19e0b.tar.bz2
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>
Diffstat (limited to 'common')
-rw-r--r--common/cmd_gpio.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/common/cmd_gpio.c b/common/cmd_gpio.c
index 9c9de28..9cc790a 100644
--- a/common/cmd_gpio.c
+++ b/common/cmd_gpio.c
@@ -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) {