msm: camera: sync: Prevent double lock/unlock on fence object

For Camera DMA and Synx object, multiple locking and
unlocking of fence object of fence object.Added check
to avoid double locking and unlocking.

CRs-Fixed: 3747628
Change-Id: I3ff9d448196c223d34f5e9ea049ff93154002422
Signed-off-by: Sourabh Soni <quic_soursoni@quicinc.com>
Este commit está contenido en:
Sourabh Soni
2024-02-29 03:12:57 +05:30
padre 8a6c3c4c6e
commit 70c2c7d653
Se han modificado 3 ficheros con 17 adiciones y 12 borrados

Ver fichero

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include "cam_sync_dma_fence.h"
@@ -779,7 +779,7 @@ void cam_dma_fence_close(void)
if (test_bit(CAM_GENERIC_FENCE_TYPE_DMA_FENCE,
&cam_sync_monitor_mask))
cam_generic_fence_update_monitor_array(i,
&g_cam_dma_fence_dev->dev_lock,
NULL,
g_cam_dma_fence_dev->monitor_data,
CAM_FENCE_OP_UNREGISTER_CB);
dma_fence_remove_callback(row->fence, &row->fence_cb);
@@ -790,7 +790,7 @@ void cam_dma_fence_close(void)
if (test_bit(CAM_GENERIC_FENCE_TYPE_DMA_FENCE,
&cam_sync_monitor_mask))
cam_generic_fence_update_monitor_array(i,
&g_cam_dma_fence_dev->dev_lock,
NULL,
g_cam_dma_fence_dev->monitor_data,
CAM_FENCE_OP_SIGNAL);
__cam_dma_fence_signal_fence(row->fence, -EADV);

Ver fichero

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include "cam_sync_synx.h"
@@ -810,7 +810,7 @@ void cam_synx_obj_close(void)
if (test_bit(CAM_GENERIC_FENCE_TYPE_SYNX_OBJ,
&cam_sync_monitor_mask))
cam_generic_fence_update_monitor_array(i,
&g_cam_synx_obj_dev->dev_lock,
NULL,
g_cam_synx_obj_dev->monitor_data,
CAM_FENCE_OP_UNREGISTER_CB);
@@ -822,7 +822,7 @@ void cam_synx_obj_close(void)
if (test_bit(CAM_GENERIC_FENCE_TYPE_SYNX_OBJ,
&cam_sync_monitor_mask))
cam_generic_fence_update_monitor_array(i,
&g_cam_synx_obj_dev->dev_lock,
NULL,
g_cam_synx_obj_dev->monitor_data,
CAM_FENCE_OP_SIGNAL);
@@ -832,7 +832,7 @@ void cam_synx_obj_close(void)
if (test_bit(CAM_GENERIC_FENCE_TYPE_SYNX_OBJ,
&cam_sync_monitor_mask))
cam_generic_fence_update_monitor_array(i,
&g_cam_synx_obj_dev->dev_lock,
NULL,
g_cam_synx_obj_dev->monitor_data,
CAM_FENCE_OP_DESTROY);

Ver fichero

@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2017-2018, 2020-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2024, Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include "cam_sync_util.h"
@@ -15,7 +15,8 @@ static int cam_generic_expand_monitor_table(int idx, struct mutex *lock,
{
struct cam_generic_fence_monitor_data *row_mon_data;
mutex_lock(lock);
if (lock)
mutex_lock(lock);
row_mon_data = mon_data[(idx / CAM_GENERIC_MONITOR_TABLE_ENTRY_SZ)];
if (!row_mon_data) {
row_mon_data = kzalloc(
@@ -27,11 +28,15 @@ static int cam_generic_expand_monitor_table(int idx, struct mutex *lock,
CAM_ERR(CAM_SYNC, "Error allocating memory %d, idx %d",
sizeof(struct cam_generic_fence_monitor_data) *
CAM_GENERIC_MONITOR_TABLE_ENTRY_SZ, idx);
mutex_unlock(lock);
if (lock)
mutex_unlock(lock);
return -ENOMEM;
}
mutex_unlock(lock);
if (lock)
mutex_unlock(lock);
return 0;
}
@@ -115,7 +120,7 @@ void cam_generic_fence_update_monitor_array(int idx,
struct cam_generic_fence_monitor_entry *row_mon_entries;
/* Validate inputs */
if (!lock || !mon_data)
if (!mon_data)
return;
row_mon_data = mon_data[(idx / CAM_GENERIC_MONITOR_TABLE_ENTRY_SZ)];