Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Kent Gibson and committed by
Bartosz Golaszewski
ef3c61a0 21249616

+2 -1
+2 -1
tools/gpio/lsgpio.c
··· 94 94 if (fd == -1) { 95 95 ret = -errno; 96 96 fprintf(stderr, "Failed to open %s\n", chrdev_name); 97 - goto exit_close_error; 97 + goto exit_free_name; 98 98 } 99 99 100 100 /* Inspect this GPIO chip */ ··· 141 141 exit_close_error: 142 142 if (close(fd) == -1) 143 143 perror("Failed to close GPIO character device file"); 144 + exit_free_name: 144 145 free(chrdev_name); 145 146 return ret; 146 147 }