Commit e890678f authored by Kent Gibson's avatar Kent Gibson Committed by Bartosz Golaszewski

tools: gpio: fix spurious close warning in gpio-utils

Fix bogus close warning that occurs when opening the character device
fails.
Signed-off-by: default avatarKent Gibson <warthog618@gmail.com>
Signed-off-by: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
parent ef3c61a0
...@@ -75,7 +75,7 @@ int gpiotools_request_linehandle(const char *device_name, unsigned int *lines, ...@@ -75,7 +75,7 @@ int gpiotools_request_linehandle(const char *device_name, unsigned int *lines,
ret = -errno; ret = -errno;
fprintf(stderr, "Failed to open %s, %s\n", fprintf(stderr, "Failed to open %s, %s\n",
chrdev_name, strerror(errno)); chrdev_name, strerror(errno));
goto exit_close_error; goto exit_free_name;
} }
for (i = 0; i < nlines; i++) for (i = 0; i < nlines; i++)
...@@ -94,9 +94,9 @@ int gpiotools_request_linehandle(const char *device_name, unsigned int *lines, ...@@ -94,9 +94,9 @@ int gpiotools_request_linehandle(const char *device_name, unsigned int *lines,
"GPIO_GET_LINEHANDLE_IOCTL", ret, strerror(errno)); "GPIO_GET_LINEHANDLE_IOCTL", ret, strerror(errno));
} }
exit_close_error:
if (close(fd) == -1) if (close(fd) == -1)
perror("Failed to close GPIO character device file"); perror("Failed to close GPIO character device file");
exit_free_name:
free(chrdev_name); free(chrdev_name);
return ret < 0 ? ret : req.fd; return ret < 0 ? ret : req.fd;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment