summaryrefslogtreecommitdiff
path: root/tools/gpio
diff options
context:
space:
mode:
authorKent Gibson <warthog618@gmail.com>2020-07-08 12:15:58 +0800
committerBartosz Golaszewski <bgolaszewski@baylibre.com>2020-07-12 10:22:01 +0200
commitef3c61a082c86a20cc1a4382142d480655b3c5a1 (patch)
tree5eb1096abcbbc4a45e6a4c2f4505365d42daca3e /tools/gpio
parent21249616f02dc3f4c5efc3b3e9ba48e428b0131c (diff)
tools: gpio: fix spurious close warning in lsgpio
Fix bogus close warning that occurs when opening the character device fails. Signed-off-by: Kent Gibson <warthog618@gmail.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Diffstat (limited to 'tools/gpio')
-rw-r--r--tools/gpio/lsgpio.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/gpio/lsgpio.c b/tools/gpio/lsgpio.c
index 8a71ad36f83b..b08d7a5e779b 100644
--- a/tools/gpio/lsgpio.c
+++ b/tools/gpio/lsgpio.c
@@ -94,7 +94,7 @@ int list_device(const char *device_name)
if (fd == -1) {
ret = -errno;
fprintf(stderr, "Failed to open %s\n", chrdev_name);
- goto exit_close_error;
+ goto exit_free_name;
}
/* Inspect this GPIO chip */
@@ -141,6 +141,7 @@ int list_device(const char *device_name)
exit_close_error:
if (close(fd) == -1)
perror("Failed to close GPIO character device file");
+exit_free_name:
free(chrdev_name);
return ret;
}