fixed coverity issues 69/154869/4 accepted/tizen/unified/20171013.193218 submit/tizen/20171013.040928
authorSejun Park <sejun79.park@samsung.com>
Wed, 11 Oct 2017 10:11:59 +0000 (19:11 +0900)
committerSejun Park <sejun79.park@samsung.com>
Wed, 11 Oct 2017 10:42:46 +0000 (19:42 +0900)
Change-Id: Ib19316b960475099e70fccdac516791daadec40c

exynos/libcsc/csc.c
exynos4/libswconverter/swconvertor.c
openmax/component/common/Exynos_OMX_Baseport.c
openmax/component/common/Exynos_OMX_Resourcemanager.c
openmax/component/video/dec/h264/Exynos_OMX_H264dec.c
openmax/component/video/dec/mpeg2/Exynos_OMX_Mpeg2dec.c
openmax/component/video/dec/mpeg4/Exynos_OMX_Mpeg4dec.c
openmax/component/video/dec/vc1/Exynos_OMX_Wmvdec.c
openmax/component/video/enc/Exynos_OMX_VencControl.c
openmax/component/video/enc/h264/Exynos_OMX_H264enc.c

index 0729db1909d7929e08e8b84bda4217f3ce171ef6..3e4df26a3717ad31f96a1e2b10b08921c3a56d45 100755 (executable)
@@ -429,11 +429,12 @@ static CSC_ERRORCODE csc_init_hw(
 #endif
         default:
             ALOGE("%s:: unsupported csc_hw_type, csc use sw", __func__);
-            csc_handle->csc_hw_handle = NULL;
             break;
         }
     }
 
+    ALOGV("%s:: CSC_METHOD=%d", __func__, csc_handle->csc_method);
+
     if (csc_handle->csc_method == CSC_METHOD_HW) {
         if (csc_handle->csc_hw_handle == NULL) {
             ALOGE("%s:: CSC_METHOD_HW can't open HW", __func__);
@@ -442,8 +443,6 @@ static CSC_ERRORCODE csc_init_hw(
         }
     }
 
-    ALOGV("%s:: CSC_METHOD=%d", __func__, csc_handle->csc_method);
-
     return ret;
 }
 
index db5f10a6b19b84a52e3a08596a7792243b864d02..82832e50907665e3b9cc09f950ffc0a4980bd19d 100755 (executable)
@@ -247,11 +247,7 @@ static void csc_tiled_to_linear_crop(
             temp1 = left&0x3F;
             if (temp3 > 192) {
                 memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset+temp1, 64-temp1);
-                temp2 = ((left+63)>>6)<<6;
                 temp3 = ((yuv420_width-right)>>6)<<6;
-                if (temp2 == temp3) {
-                    temp2 = yuv420_width-right-(64-temp1);
-                }
                 memcpy(yuv420_dest+linear_offset+64-temp1, nv12t_src+tiled_offset+2048, 64);
                 memcpy(yuv420_dest+linear_offset+128-temp1, nv12t_src+tiled_offset1, 64);
                 memcpy(yuv420_dest+linear_offset+192-temp1, nv12t_src+tiled_offset1+2048, 64);
index 6452dce21d7790ef0974740759aba5991d29d141..1e2b95483d1925a344491a090cb6fd7ea42454ca 100755 (executable)
@@ -138,9 +138,8 @@ EXIT:
     if (ret != OMX_ErrorNone) {
         Exynos_OSAL_Log(EXYNOS_LOG_ERROR,"%s : %d", __FUNCTION__, __LINE__);
 
-        if ((pOMXComponent != NULL) && (pExynosComponent != NULL)) {
+        if (pExynosComponent != NULL)
             pExynosComponent->pCallbacks->EventHandler(pOMXComponent, pExynosComponent->callbackData, OMX_EventError, ret, 0, NULL);
-        }
     }
 
     FunctionOut();
index 8741ea8bd53c4d03b6430745185f67ed52f26f6d..208a511d6fc5f128ee65ad4aeea1fcfe377cb035 100755 (executable)
@@ -139,7 +139,7 @@ int searchLowPriority(EXYNOS_OMX_RM_COMPONENT_LIST *RMComp_list, OMX_U32 inComp_
     EXYNOS_OMX_RM_COMPONENT_LIST *pCandidateComp = NULL;
 
     if (RMComp_list == NULL)
-        ret = -1;
+        return -1;
 
     pTempComp = RMComp_list;
     *outLowComp = 0;
index 902126f547156b29b1e4bcedf7eb0b7a039c2dfa..2f136b5ddd7024fe3abb4415d4682396165e6021 100755 (executable)
@@ -591,11 +591,6 @@ OMX_ERRORTYPE H264CodecSrcInit(OMX_COMPONENTTYPE *pOMXComponent)
                 Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "@pVideoDec->pMFCDecInputBuffer[%d]->pVirAddr[%d]: 0x%x", i, plane, pVideoDec->pMFCDecInputBuffer[i]->pVirAddr[plane]);
             }
 
-#ifdef TIZEN_FEATURE_E54XX
-            if (pExynosInputPort == NULL || pExynosOutputPort == NULL || pOMXComponent == NULL) {
-                Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "invalid param: pExynosInputPort= %p pExynosOutputPort= %p pOMXComponent= %p", pExynosInputPort, pExynosOutputPort, pOMXComponent);
-            }
-#endif
             Exynos_CodecBufferEnQueue(pExynosComponent, INPUT_PORT_INDEX, pVideoDec->pMFCDecInputBuffer[i]);
         }
     } else if (pExynosInputPort->bufferProcessType & BUFFER_SHARE) {
@@ -2322,7 +2317,7 @@ OMX_ERRORTYPE Exynos_H264Dec_DstOut(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX
                 break;
             } else {
                 ret = OMX_ErrorUndefined;
-                break;
+                goto EXIT;
             }
         }
     }
index 399f547bb5f490ead10a454e9036c58e18d8c30e..d70e9f39b65d0632139f03a2d5a7021ca8c8ebf3 100755 (executable)
@@ -459,11 +459,6 @@ OMX_ERRORTYPE Mpeg2CodecSrcInit(OMX_COMPONENTTYPE *pOMXComponent)
                 Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "@pVideoDec->pMFCDecInputBuffer[%d]->pVirAddr[%d]: 0x%x", i, plane, pVideoDec->pMFCDecInputBuffer[i]->pVirAddr[plane]);
             }
 
-#ifdef TIZEN_FEATURE_E54XX
-            if (pExynosInputPort == NULL || pExynosOutputPort == NULL || pOMXComponent == NULL) {
-                Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "invalid param: pExynosInputPort= %p pExynosOutputPort= %p pOMXComponent= %p", pExynosInputPort, pExynosOutputPort, pOMXComponent);
-            }
-#endif
             Exynos_CodecBufferEnQueue(pExynosComponent, INPUT_PORT_INDEX, pVideoDec->pMFCDecInputBuffer[i]);
         }
     } else if (pExynosInputPort->bufferProcessType == BUFFER_SHARE) {
@@ -1496,9 +1491,6 @@ OMX_ERRORTYPE Exynos_Mpeg2Dec_Init(OMX_COMPONENTTYPE *pOMXComponent)
            }
         }  else {
 #ifdef TBM_BUF_FD
-            if (pOMXComponent == NULL) {
-                Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s : %d: invalid parm: pOMXComponent = %p", __FUNCTION__, __LINE__, pOMXComponent);
-            }
             ret = Mpeg2CodecSrcInit(pOMXComponent);
             if (ret != OMX_ErrorNone) {
                 Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s : FAILED. RetCode :[0x%X]", __FUNCTION__,ret);
index 591ec0353399cf13d806177f820a886ab4ddedd3..d3d7bcc60baa83f0028d533e7c237758f9c2fcf6 100755 (executable)
@@ -2233,6 +2233,7 @@ OMX_ERRORTYPE Exynos_Mpeg4Dec_SrcIn(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX
     }
     if (pMpeg4Dec->hMFCMpeg4Handle.bConfiguredMFCDst == OMX_FALSE) {
         ret = Mpeg4CodecDstSetup(pOMXComponent);
+        goto EXIT;
     }
 
   if (((bInStartCode = Check_Stream_StartCode(pSrcInputData->buffer.singlePlaneBuffer.dataBuffer, oneFrameSize, pMpeg4Dec->hMFCMpeg4Handle.codecType)) == OMX_TRUE) ||
@@ -2446,7 +2447,7 @@ OMX_ERRORTYPE Exynos_Mpeg4Dec_DstOut(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OM
                 break;
             } else {
                 ret = OMX_ErrorUndefined;
-                break;
+                goto EXIT;
             }
         }
     }
index 809ea3e1a37e62298377460a5c9c1a8c619708a2..ff803cd6d113b2b89251048efafb1c8b4abe8147 100755 (executable)
@@ -276,8 +276,7 @@ static OMX_BOOL Make_Stream_MetaData(
             width = pBitmapInfoHeader->BiWidth;
             height = pBitmapInfoHeader->BiHeight;
 #endif
-            if (*pStreamSize > BITMAPINFOHEADER_SIZE)
-                Exynos_OSAL_Memcpy(struct_C, pInputStream+BITMAPINFOHEADER_SIZE, 4);
+            Exynos_OSAL_Memcpy(struct_C, pInputStream+BITMAPINFOHEADER_SIZE, 4);
 
             Exynos_OSAL_Memcpy(pCurrBuf + currPos, const_C5, 4);
             currPos +=4;
@@ -2278,7 +2277,7 @@ OMX_ERRORTYPE Exynos_WmvDec_DstOut(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_
                 break;
             } else {
                 ret = OMX_ErrorUndefined;
-                break;
+                goto EXIT;
             }
         }
     }
index c68a04836960edd4594e2fbb631487d1dab88531..22da15f513a293ccb8912f763e61998ec6423964 100755 (executable)
@@ -632,8 +632,12 @@ OMX_ERRORTYPE Exynos_OMX_BufferFlush(
         Exynos_OSAL_MutexLock(pDataBuffer[1]->bufferMutex);
 
     ret = Exynos_OMX_FlushPort(pOMXComponent, nPortIndex);
-    if (ret != OMX_ErrorNone)
+    if (ret != OMX_ErrorNone) {
+        if (pDataBuffer[1] != NULL)
+            Exynos_OSAL_MutexUnlock(pDataBuffer[1]->bufferMutex);
+        Exynos_OSAL_MutexUnlock(pDataBuffer[0]->bufferMutex);
         goto EXIT;
+    }
 
     if (pExynosPort->bufferProcessType & BUFFER_COPY)
         pVideoEnc->exynos_codec_enqueueAllBuffer(pOMXComponent, nPortIndex);
index 2c451a474ea831144750fbf8014cbb69692f715f..9fac3407439999a7eeba1f2d889f8ff2fbfdd985 100755 (executable)
@@ -1870,6 +1870,8 @@ OMX_ERRORTYPE Exynos_H264Enc_SrcIn(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_
     }
     if (pH264Enc->hMFCH264Handle.bConfiguredMFCDst == OMX_FALSE) {
         ret = H264CodecDstSetup(pOMXComponent);
+        if (ret != OMX_ErrorNone)
+            goto EXIT;
     }
     if (pVideoEnc->configChange == OMX_TRUE) {
         Change_H264Enc_Param(pExynosComponent);