From 854a8fb23aee9f53cf2107883e7f8b2b00f23945 Mon Sep 17 00:00:00 2001 From: Vidhoon Viswanathan Date: Wed, 2 May 2012 04:59:13 -0700 Subject: [DOMX]: Fix error handling in RPC_sendPacket_sync Ducati faulty state is determined by the following inference condition: if(status<0 && errno==ENXIO) { //ducati in faulty state } After write call, errno was checked in wrong manner. Also, write call returns number of bytes written. This patch checks errno in case of write call failure and detects faulty state of ducati. And it uses status == nPacketSize as a tighter condition to validate write call success. Change-Id: I2062e128c4754b0faef2c33ca9465129105ade0c Signed-off-by: Vidhoon Viswanathan --- domx/omx_rpc/src/omx_rpc_stub.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'domx') diff --git a/domx/omx_rpc/src/omx_rpc_stub.c b/domx/omx_rpc/src/omx_rpc_stub.c index e650361..0c28ba1 100755 --- a/domx/omx_rpc/src/omx_rpc_stub.c +++ b/domx/omx_rpc/src/omx_rpc_stub.c @@ -100,9 +100,13 @@ status = write(hCtx->fd_omx, pPacket, nPacketSize); \ RPC_freePacket(pPacket); \ pPacket = NULL; \ - if(status < 0 ) DOMX_ERROR("DOMX Write failed 0x%x %d",status,status); \ - RPC_assert(status >= 0 && errno != ENXIO, RPC_OMX_ErrorHardware, "Write failed due ducati in faulty state"); \ - RPC_assert(status >= 0, RPC_OMX_ErrorUndefined, "Write failed"); \ + if(status < 0 && errno == ENXIO) { \ + RPC_assert(0, RPC_OMX_ErrorHardware, "Write failed - Ducati in faulty state"); \ + } \ + if(status != (signed)nPacketSize) { \ + DOMX_ERROR("Write failed returning status = 0x%x",status); \ + RPC_assert(0, RPC_OMX_ErrorUndefined, "Write failed"); \ + } \ eError = TIMM_OSAL_ReadFromPipe(hCtx->pMsgPipe[nFxnIdx], &pRetPacket, \ RPC_MSG_SIZE_FOR_PIPE, (TIMM_OSAL_U32 *)(&nSize), TIMM_OSAL_SUSPEND); \ RPC_assert(eError == TIMM_OSAL_ERR_NONE, eError, \ -- cgit v1.1