diff --git a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp index 0d6f5af52d..295ba3668b 100644 --- a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp +++ b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp @@ -727,8 +727,10 @@ TEST_P(GraphicsMapperHidlTest, FlushRereadBasic) { int fence; ASSERT_NO_FATAL_FAILURE(fence = mGralloc->flushLockedBuffer(writeBufferHandle)); - ASSERT_EQ(0, sync_wait(fence, 3500)); - close(fence); + if (fence >= 0) { + ASSERT_EQ(0, sync_wait(fence, 3500)); + close(fence); + } ASSERT_NO_FATAL_FAILURE(mGralloc->rereadLockedBuffer(readBufferHandle));