From: Kent Gibson Date: Wed, 8 Jul 2020 04:15:58 +0000 (+0800) Subject: tools: gpio: fix spurious close warning in lsgpio X-Git-Tag: v5.10.7~1950^2~35^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ef3c61a082c86a20cc1a4382142d480655b3c5a1;p=platform%2Fkernel%2Flinux-rpi.git 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 Signed-off-by: Bartosz Golaszewski --- diff --git a/tools/gpio/lsgpio.c b/tools/gpio/lsgpio.c index 8a71ad3..b08d7a5 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; }