The test added line 251 of sgx_dcap_tvl.cpp is at odd with line 186, which is now ignored. sgx_ret should probably be set back to SGX_SUCCESS on line 186, or maybe the test of line 251 should also check that ret has not been set to something different from SGX_QL_ERROR_UNEXPECTED.