[U-Boot] [PATCH 4/6] video: test: Adjust order of file closure

Simon Glass sjg at chromium.org
Sat Jan 30 23:45:17 CET 2016


Close the file earlier to hopefully fix a Coverity error.

Reported-by: Coverity (CID: 134901)

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 test/dm/video.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/dm/video.c b/test/dm/video.c
index de22328..4d000fa 100644
--- a/test/dm/video.c
+++ b/test/dm/video.c
@@ -249,9 +249,9 @@ static int read_file(struct unit_test_state *uts, const char *fname,
 	fd = os_open(fname, OS_O_RDONLY);
 	ut_assert(fd >= 0);
 	size = os_read(fd, buf, buf_size);
+	os_close(fd);
 	ut_assert(size >= 0);
 	ut_assert(size < buf_size);
-	os_close(fd);
 	*addrp = addr;
 
 	return 0;
-- 
2.7.0.rc3.207.g0ac5344



More information about the U-Boot mailing list