summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKent Gibson <warthog618@gmail.com>2020-07-08 12:16:00 +0800
committerBartosz Golaszewski <bgolaszewski@baylibre.com>2020-07-12 10:22:01 +0200
commitdf51f402e3b15b00284309bd3016bb4536d2260c (patch)
treee71e7eceedd626492e1bc89ceca5be1409764039
parente890678f6949e848720c66620c390d5e876149a6 (diff)
downloadlinux-df51f402e3b15b00284309bd3016bb4536d2260c.tar.gz
linux-df51f402e3b15b00284309bd3016bb4536d2260c.tar.bz2
linux-df51f402e3b15b00284309bd3016bb4536d2260c.zip
tools: gpio: fix spurious close warning in gpio-event-mon
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>
-rw-r--r--tools/gpio/gpio-event-mon.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/gpio/gpio-event-mon.c b/tools/gpio/gpio-event-mon.c
index 30ed0e06f52a..1a303a81aeef 100644
--- a/tools/gpio/gpio-event-mon.c
+++ b/tools/gpio/gpio-event-mon.c
@@ -45,7 +45,7 @@ int monitor_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;
}
req.lineoffset = line;
@@ -117,6 +117,7 @@ int monitor_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;
}