diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2022-09-28 16:20:48 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-09-28 16:20:54 +0200 |
commit | 252c76cdf8c9d516589d72ac228ac0d19fcb2021 (patch) | |
tree | 3ec04ed95b87e079d1015d8df2c6e34a543205f2 | |
parent | 71c97aeb9be6af16347b9e64615a9a774aee2f9e (diff) | |
download | barebox-252c76cdf8c9d516589d72ac228ac0d19fcb2021.tar.gz barebox-252c76cdf8c9d516589d72ac228ac0d19fcb2021.tar.xz |
gpiolib: Fix gpioinfo without args
Since a30ae2921a the gpioinfo command crashes when called without
arguments. Fix it by using argv[1] when it actually exists, not when
it doesn't exist.
Fixes: a30ae2921a ("gpiolib: gpioinfo: add optional CONTROLLER command line argument")
Reported-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | drivers/gpio/gpiolib.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 7f20709035..2503262d65 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -681,7 +681,7 @@ static int do_gpiolib(int argc, char *argv[]) if (argc > 2) return COMMAND_ERROR_USAGE; - if (argc == 1) { + if (argc > 1) { struct device_d *dev; dev = find_device(argv[1]); |