diff mbox

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

Message ID 1454193919-27264-4-git-send-email-sjg@chromium.org
State Accepted
Commit a108082d4db959544c4340ced7dcdb45ec3679da
Delegated to: Anatolij Gustschin
Headers show

Commit Message

Simon Glass Jan. 30, 2016, 10:45 p.m. UTC
Close the file earlier to hopefully fix a Coverity error.

Reported-by: Coverity (CID: 134901)

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

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

Comments

Tom Rini Feb. 1, 2016, 4:54 p.m. UTC | #1
On Sat, Jan 30, 2016 at 03:45:17PM -0700, Simon Glass wrote:

> 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>
Anatolij Gustschin Feb. 6, 2016, 1:06 p.m. UTC | #2
On Sat, 30 Jan 2016 15:45:17 -0700
Simon Glass sjg@chromium.org wrote:

> Close the file earlier to hopefully fix a Coverity error.
> 
> Reported-by: Coverity (CID: 134901)
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  test/dm/video.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

applied to u-boot-staging, thanks!

--
Anatolij
diff mbox

Patch

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;