* [PATCH] selftests: media_device_test fix to close the fd before exit
@ 2016-04-05 3:41 Shuah Khan
0 siblings, 0 replies; only message in thread
From: Shuah Khan @ 2016-04-05 3:41 UTC (permalink / raw)
To: linux-kselftest, linux-kernel; +Cc: Shuah Khan
Fix it to close the fd before exit and in error legs.
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
tools/testing/selftests/media_tests/media_device_test.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/media_tests/media_device_test.c b/tools/testing/selftests/media_tests/media_device_test.c
index cbf53a0..dfb3ca6 100644
--- a/tools/testing/selftests/media_tests/media_device_test.c
+++ b/tools/testing/selftests/media_tests/media_device_test.c
@@ -84,12 +84,14 @@ int main(int argc, char **argv)
while (count < 100) {
ret = ioctl(fd, MEDIA_IOC_DEVICE_INFO, &mdi);
- if (ret < 0)
+ if (ret < 0) {
printf("Media Device Info errno %s\n", strerror(errno));
- else
- printf("Media device model %s driver %s\n",
- mdi.model, mdi.driver);
+ break;
+ }
+ printf("Media device model %s driver %s\n",
+ mdi.model, mdi.driver);
sleep(10);
count++;
}
+ close(fd);
}
--
2.5.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-04-05 3:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-05 3:41 [PATCH] selftests: media_device_test fix to close the fd before exit Shuah Khan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).