From c17d1a6d87f41a9e4a77e23b4656a632deef26f0 Mon Sep 17 00:00:00 2001 From: Shuzhen Wang Date: Tue, 8 Aug 2017 14:01:15 -0700 Subject: QCamera2/HAL3: correct mutex lock/unlock sequence Bug: 36716469 CRs-Fixed: 2053027 Change-Id: I6699c3682eec419fb6efb0583e9909e5739476a0 (cherry picked from commit aa3b55c1b278c52d8e93853c9f89e8a475d59026) (cherry picked from commit 78ad69467eefa405f54d36472cdcf535c0b500b1) --- camera/QCamera2/HAL3/QCamera3HWI.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'camera/QCamera2/HAL3/QCamera3HWI.cpp') diff --git a/camera/QCamera2/HAL3/QCamera3HWI.cpp b/camera/QCamera2/HAL3/QCamera3HWI.cpp index 3d17918e..8ab7102f 100644 --- a/camera/QCamera2/HAL3/QCamera3HWI.cpp +++ b/camera/QCamera2/HAL3/QCamera3HWI.cpp @@ -3948,6 +3948,7 @@ int QCamera3HardwareInterface::processCaptureRequest( (mLinkedCameraId != mCameraId) ) { LOGE("Dualcam: mLinkedCameraId %d is invalid, current cam id = %d", mLinkedCameraId, mCameraId); + pthread_mutex_unlock(&mMutex); goto error_exit; } } @@ -3965,6 +3966,7 @@ int QCamera3HardwareInterface::processCaptureRequest( if (sessionId[mLinkedCameraId] == 0xDEADBEEF) { LOGE("Dualcam: Invalid Session Id "); pthread_mutex_unlock(&gCamLock); + pthread_mutex_unlock(&mMutex); goto error_exit; } @@ -3984,6 +3986,7 @@ int QCamera3HardwareInterface::processCaptureRequest( mCameraHandle->camera_handle, m_pRelCamSyncBuf); if (rc < 0) { LOGE("Dualcam: link failed"); + pthread_mutex_unlock(&mMutex); goto error_exit; } } @@ -4183,6 +4186,7 @@ no_error: if(ADD_SET_PARAM_ENTRY_TO_BATCH(mParameters, CAM_INTF_META_FRAME_NUMBER, request->frame_number)) { LOGE("Failed to set the frame number in the parameters"); + pthread_mutex_unlock(&mMutex); return BAD_VALUE; } } @@ -4488,6 +4492,7 @@ no_error: /* Update stream id of all the requested buffers */ if (ADD_SET_PARAM_ENTRY_TO_BATCH(mParameters, CAM_INTF_META_STREAM_ID, streamsArray)) { LOGE("Failed to set stream type mask in the parameters"); + pthread_mutex_unlock(&mMutex); return BAD_VALUE; } -- cgit v1.2.3