From 252c76cdf8c9d516589d72ac228ac0d19fcb2021 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Wed, 28 Sep 2022 16:20:48 +0200 Subject: 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 Signed-off-by: Sascha Hauer --- drivers/gpio/gpiolib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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]); -- cgit v1.2.3