[PATCH 2/5] lib: Close non intel fds in drm_get_card()

Damien Lespiau
2013-10-24T14:41:07Z

When going through card%u devices, close the ones that we were able to
open but weren't intel devices.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
lib/drmtest.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/drmtest.c b/lib/drmtest.c
index b94981e..3b80920 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -187,8 +187,10 @@ int drm_get_card(void)
if (fd == -1)
continue;

- if (!is_intel(fd))
+ if (!is_intel(fd)) {
+ close(fd);
continue;
+ }

close(fd);
return i;
--
1.8.3.1