Stefan Tauner (stefan.tauner@gmx.at) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3025
-gerrit
commit 73a20080249239a7b3fd3e04d910335f780b5040 Author: Stefan Tauner stefan.tauner@gmx.at Date: Fri Apr 5 01:23:32 2013 +0200
inteltool: clean up file descriptors a bit
Paul Menzel reported that Cppcheck 1.59 reported an unused variable io_fd. While that is true, the underlying issue is that the file descriptors are not closed properly at the end. "a bit" refers to the numerous exit calls all around that of course circumvent the cleanup.
Arguably one could live without cleaning up because it is done automatically anyway.
Change-Id: Ifd46314672ca431d820fb3842bfbf12decc90f9b Signed-off-by: Stefan Tauner stefan.tauner@gmx.at --- util/inteltool/inteltool.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/util/inteltool/inteltool.c b/util/inteltool/inteltool.c index 2396eb0..6c073ce 100644 --- a/util/inteltool/inteltool.c +++ b/util/inteltool/inteltool.c @@ -26,9 +26,7 @@ #include <fcntl.h> #include <sys/mman.h> #include "inteltool.h" -#if defined(__FreeBSD__) #include <unistd.h> -#endif
/* * http://pci-ids.ucw.cz/read/PC/8086 @@ -307,9 +305,6 @@ int main(int argc, char *argv[])
#if defined(__FreeBSD__) int io_fd; -#endif - -#if defined(__FreeBSD__) if ((io_fd = open("/dev/io", O_RDWR)) < 0) { perror("/dev/io"); #else @@ -450,5 +445,12 @@ int main(int argc, char *argv[]) // pci_free_dev(sb); // TODO: glibc detected "double free or corruption" pci_cleanup(pacc);
+#if defined(__FreeBSD__) + close(io_fd); +#endif + +#ifndef __DARWIN__ + close(fd_mem); +#endif return 0; }