소스 검색

video: test: Adjust order of file closure

Close the file earlier to hopefully fix a Coverity error.

Reported-by: Coverity (CID: 134901)

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Simon Glass 9 년 전
부모
커밋
a108082d4d
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      test/dm/video.c

+ 1 - 1
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;