Fixes: https://bugs.linaro.org/show_bug.cgi?id=2148 (CID 159393)
The if statement introduced here is redundant with the previous
CU_ASSERT_FATAL, but avoids the coverity warning.
(coverity probably misses the longjump in CU_ASSERT_FATAL)

Signed-off-by: Christophe Milard <christophe.mil...@linaro.org>
---

NOTE: to be applied on to of: "linux-generic: test: shmem: close fifo"

 platform/linux-generic/test/shmem/shmem_odp.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/platform/linux-generic/test/shmem/shmem_odp.c 
b/platform/linux-generic/test/shmem/shmem_odp.c
index a1f750f..77c5a01 100644
--- a/platform/linux-generic/test/shmem/shmem_odp.c
+++ b/platform/linux-generic/test/shmem/shmem_odp.c
@@ -47,9 +47,11 @@ void shmem_test_odp_shm_proc(void)
        fd = open(fifo_name, O_RDONLY);
        CU_ASSERT_FATAL(fd >= 0);
 
-       CU_ASSERT(read(fd, &test_result, sizeof(char)) == 1);
-       close(fd);
-       CU_ASSERT_FATAL(test_result == TEST_SUCCESS);
+       if (fd >= 0) {  /* redundant, but to avoid coverity CID 159393 */
+               CU_ASSERT_FATAL(read(fd, &test_result, sizeof(char)) == 1);
+               close(fd);
+               CU_ASSERT_FATAL(test_result == TEST_SUCCESS);
+       }
 
        CU_ASSERT(odp_shm_free(shm) == 0);
 }
-- 
2.1.4

_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to