فهرست منبع

msm: camera: sync: Add extra support for monitor dump

Add monitor dump when dma/synx is already in signaled
state or has registered a cb, and when sync fails to
signal its corresponding dma/synx.

CRs-Fixed: 3350863
Change-Id: I4b52647f1d3f53eff119df1ab143be6848dd0d5d
Signed-off-by: Haochen Yang <[email protected]>
Haochen Yang 2 سال پیش
والد
کامیت
ae91bc4768

+ 33 - 54
drivers/cam_sync/cam_sync.c

@@ -144,8 +144,7 @@ int cam_sync_register_callback(sync_callback cb_func,
 {
 	struct sync_callback_info *sync_cb;
 	struct sync_table_row *row = NULL;
-	int status = 0;
-	int rc = 0;
+	int status = 0, rc = 0;
 
 	if ((sync_obj >= CAM_SYNC_MAX_OBJS) || (sync_obj <= 0) || (!cb_func))
 		return -EINVAL;
@@ -156,8 +155,7 @@ int cam_sync_register_callback(sync_callback cb_func,
 	if (row->state == CAM_SYNC_STATE_INVALID) {
 		CAM_ERR(CAM_SYNC,
 			"Error: accessing an uninitialized sync obj %s[%d]",
-			row->name,
-			sync_obj);
+			row->name, sync_obj);
 		rc = -EINVAL;
 		goto monitor_dump;
 	}
@@ -243,15 +241,13 @@ int cam_sync_deregister_callback(sync_callback cb_func,
 	if (row->state == CAM_SYNC_STATE_INVALID) {
 		CAM_ERR(CAM_SYNC,
 			"Error: accessing an uninitialized sync obj = %s[%d]",
-			row->name,
-			sync_obj);
+			row->name, sync_obj);
 		rc = -EINVAL;
 		goto monitor_dump;
 	}
 
 	CAM_DBG(CAM_SYNC, "deregistered callback for sync object:%s[%d]",
-		row->name,
-		sync_obj);
+		row->name, sync_obj);
 	list_for_each_entry_safe(sync_cb, temp, &row->callback_list, list) {
 		if ((sync_cb->callback_func == cb_func) &&
 			(sync_cb->cb_data == userdata)) {
@@ -434,11 +430,13 @@ int cam_sync_signal(int32_t sync_obj, uint32_t status, uint32_t event_cause)
 	 * waiting on this fence can start processing
 	 */
 	if (test_bit(CAM_GENERIC_FENCE_TYPE_DMA_FENCE, &row->ext_fence_mask)) {
-		rc =  cam_sync_signal_dma_fence_util(row, status);
-		if (rc)
+		rc = cam_sync_signal_dma_fence_util(row, status);
+		if (rc) {
 			CAM_ERR(CAM_SYNC,
 				"Error: Failed to signal associated dma fencefd = %d for sync_obj = %s[%d]",
 				row->dma_fence_info.dma_fence_fd, row->name, sync_obj);
+			cam_sync_dump_monitor_array(row);
+		}
 	}
 
 #if IS_ENABLED(CONFIG_TARGET_SYNX_ENABLE)
@@ -454,10 +452,12 @@ int cam_sync_signal(int32_t sync_obj, uint32_t status, uint32_t event_cause)
 		spin_unlock_bh(&sync_dev->row_spinlocks[sync_obj]);
 		rc = cam_synx_obj_internal_signal(synx_row_idx, &signal_synx_obj);
 		spin_lock_bh(&sync_dev->row_spinlocks[sync_obj]);
-		if (rc)
+		if (rc) {
 			CAM_ERR(CAM_SYNC,
 				"Error: Failed to signal associated synx obj = %d for sync_obj = %d",
 				signal_synx_obj.synx_obj, sync_obj);
+			cam_sync_dump_monitor_array(row);
+		}
 	}
 #endif
 
@@ -488,10 +488,9 @@ monitor_dump:
 
 int cam_sync_merge(int32_t *sync_obj, uint32_t num_objs, int32_t *merged_obj)
 {
-	int rc;
+	int rc, i;
 	long idx = 0;
 	bool bit;
-	int i = 0;
 
 	if ((!sync_obj) || (!merged_obj)) {
 		CAM_ERR(CAM_SYNC, "Invalid pointer(s)");
@@ -526,8 +525,7 @@ int cam_sync_merge(int32_t *sync_obj, uint32_t num_objs, int32_t *merged_obj)
 
 	spin_lock_bh(&sync_dev->row_spinlocks[idx]);
 	rc = cam_sync_init_group_object(sync_dev->sync_table,
-		idx, sync_obj,
-		num_objs);
+		idx, sync_obj, num_objs);
 	if (rc < 0) {
 		CAM_ERR(CAM_SYNC, "Error: Unable to init row at idx = %ld",
 			idx);
@@ -555,8 +553,7 @@ int cam_sync_get_obj_ref(int32_t sync_obj)
 	if (row->state != CAM_SYNC_STATE_ACTIVE) {
 		CAM_ERR(CAM_SYNC,
 			"Error: accessing an uninitialized sync obj = %s[%d]",
-			row->name,
-			sync_obj);
+			row->name, sync_obj);
 		rc = -EINVAL;
 		goto monitor_dump;
 	}
@@ -605,8 +602,7 @@ int cam_sync_check_valid(int32_t sync_obj)
 
 	if (!test_bit(sync_obj, sync_dev->bitmap)) {
 		CAM_ERR(CAM_SYNC, "Error: Released sync obj received %s[%d]",
-			row->name,
-			sync_obj);
+			row->name, sync_obj);
 		rc = -EINVAL;
 		goto monitor_dump;
 	}
@@ -614,8 +610,7 @@ int cam_sync_check_valid(int32_t sync_obj)
 	if (row->state == CAM_SYNC_STATE_INVALID) {
 		CAM_ERR(CAM_SYNC,
 			"Error: accessing an uninitialized sync obj = %s[%d]",
-			row->name,
-			sync_obj);
+			row->name, sync_obj);
 		rc = -EINVAL;
 		goto monitor_dump;
 	}
@@ -642,8 +637,7 @@ int cam_sync_wait(int32_t sync_obj, uint64_t timeout_ms)
 	if (row->state == CAM_SYNC_STATE_INVALID) {
 		CAM_ERR(CAM_SYNC,
 			"Error: accessing an uninitialized sync obj = %s[%d]",
-			row->name,
-			sync_obj);
+			row->name, sync_obj);
 		rc = -EINVAL;
 		goto monitor_dump;
 	}
@@ -706,8 +700,7 @@ static int cam_sync_handle_create(struct cam_private_ioctl_arg *k_ioctl)
 	if (!result)
 		if (copy_to_user(
 			u64_to_user_ptr(k_ioctl->ioctl_ptr),
-			&sync_create,
-			k_ioctl->size))
+			&sync_create, k_ioctl->size))
 			return -EFAULT;
 
 	return result;
@@ -725,8 +718,7 @@ static int cam_sync_handle_signal(struct cam_private_ioctl_arg *k_ioctl)
 		return -EINVAL;
 
 	if (copy_from_user(&sync_signal,
-		u64_to_user_ptr(k_ioctl->ioctl_ptr),
-		k_ioctl->size))
+		u64_to_user_ptr(k_ioctl->ioctl_ptr), k_ioctl->size))
 		return -EFAULT;
 
 	/* need to get ref for UMD signaled fences */
@@ -758,8 +750,7 @@ static int cam_sync_handle_merge(struct cam_private_ioctl_arg *k_ioctl)
 		return -EINVAL;
 
 	if (copy_from_user(&sync_merge,
-		u64_to_user_ptr(k_ioctl->ioctl_ptr),
-		k_ioctl->size))
+		u64_to_user_ptr(k_ioctl->ioctl_ptr), k_ioctl->size))
 		return -EFAULT;
 
 	if (sync_merge.num_objs >= CAM_SYNC_MAX_OBJS)
@@ -781,14 +772,12 @@ static int cam_sync_handle_merge(struct cam_private_ioctl_arg *k_ioctl)
 	num_objs = sync_merge.num_objs;
 
 	result = cam_sync_merge(sync_objs,
-		num_objs,
-		&sync_merge.merged);
+		num_objs, &sync_merge.merged);
 
 	if (!result)
 		if (copy_to_user(
 			u64_to_user_ptr(k_ioctl->ioctl_ptr),
-			&sync_merge,
-			k_ioctl->size)) {
+			&sync_merge, k_ioctl->size)) {
 			kfree(sync_objs);
 			return -EFAULT;
 	}
@@ -809,8 +798,7 @@ static int cam_sync_handle_wait(struct cam_private_ioctl_arg *k_ioctl)
 		return -EINVAL;
 
 	if (copy_from_user(&sync_wait,
-		u64_to_user_ptr(k_ioctl->ioctl_ptr),
-		k_ioctl->size))
+		u64_to_user_ptr(k_ioctl->ioctl_ptr), k_ioctl->size))
 		return -EFAULT;
 
 	k_ioctl->result = cam_sync_wait(sync_wait.sync_obj,
@@ -830,8 +818,7 @@ static int cam_sync_handle_destroy(struct cam_private_ioctl_arg *k_ioctl)
 		return -EINVAL;
 
 	if (copy_from_user(&sync_create,
-		u64_to_user_ptr(k_ioctl->ioctl_ptr),
-		k_ioctl->size))
+		u64_to_user_ptr(k_ioctl->ioctl_ptr), k_ioctl->size))
 		return -EFAULT;
 
 	return cam_sync_destroy(sync_create.sync_obj);
@@ -876,8 +863,7 @@ static int cam_sync_handle_register_user_payload(
 	if (row->state == CAM_SYNC_STATE_INVALID) {
 		CAM_ERR(CAM_SYNC,
 			"Error: accessing an uninitialized sync obj = %s[%d]",
-			row->name,
-			sync_obj);
+			row->name, sync_obj);
 		spin_unlock_bh(&sync_dev->row_spinlocks[sync_obj]);
 		kfree(user_payload_kernel);
 		return -EINVAL;
@@ -893,8 +879,7 @@ static int cam_sync_handle_register_user_payload(
 				CAM_FENCE_OP_SKIP_REGISTER_CB);
 
 		cam_sync_util_send_v4l2_event(CAM_SYNC_V4L_EVENT_ID_CB_TRIG,
-			sync_obj,
-			row->state,
+			sync_obj, row->state,
 			user_payload_kernel->payload_data,
 			CAM_SYNC_USER_PAYLOAD_SIZE * sizeof(__u64),
 			CAM_SYNC_COMMON_REG_PAYLOAD_EVENT);
@@ -905,9 +890,7 @@ static int cam_sync_handle_register_user_payload(
 	}
 
 	list_for_each_entry_safe(user_payload_iter,
-		temp_upayload_kernel,
-		&row->user_payload_list,
-		list) {
+		temp_upayload_kernel, &row->user_payload_list, list) {
 		if (user_payload_iter->payload_data[0] ==
 				user_payload_kernel->payload_data[0] &&
 			user_payload_iter->payload_data[1] ==
@@ -955,8 +938,7 @@ static int cam_sync_handle_deregister_user_payload(
 	}
 
 	if (copy_from_user(&userpayload_info,
-		u64_to_user_ptr(k_ioctl->ioctl_ptr),
-		k_ioctl->size))
+		u64_to_user_ptr(k_ioctl->ioctl_ptr), k_ioctl->size))
 		return -EFAULT;
 
 	sync_obj = userpayload_info.sync_obj;
@@ -964,7 +946,7 @@ static int cam_sync_handle_deregister_user_payload(
 		return -EINVAL;
 
 	spin_lock_bh(&sync_dev->row_spinlocks[sync_obj]);
-	row =  sync_dev->sync_table + sync_obj;
+	row = sync_dev->sync_table + sync_obj;
 
 	if (row->state == CAM_SYNC_STATE_INVALID) {
 		CAM_ERR(CAM_SYNC,
@@ -1783,7 +1765,6 @@ static int cam_generic_fence_handle_synx_import(
 			goto out_copy;
 		}
 
-
 		if ((fence_cfg->sync_obj > 0) && (fence_cfg->sync_obj < CAM_SYNC_MAX_OBJS)) {
 			/* Associate synx object with existing sync object */
 			rc = cam_sync_synx_associate_obj(fence_cfg->sync_obj,
@@ -2453,8 +2434,7 @@ static int cam_sync_open(struct file *filep)
 
 static int cam_sync_close(struct file *filep)
 {
-	int rc = 0;
-	int i;
+	int rc = 0, i;
 	struct sync_device *sync_dev = video_drvdata(filep);
 
 	if (!sync_dev) {
@@ -2558,7 +2538,7 @@ static struct v4l2_subscribed_event_ops cam_sync_v4l2_ops = {
 };
 
 int cam_sync_subscribe_event(struct v4l2_fh *fh,
-		const struct v4l2_event_subscription *sub)
+	const struct v4l2_event_subscription *sub)
 {
 	if (!((sub->type == CAM_SYNC_V4L_EVENT) ||
 	(sub->type == CAM_SYNC_V4L_EVENT_V2))) {
@@ -2573,7 +2553,7 @@ int cam_sync_subscribe_event(struct v4l2_fh *fh,
 }
 
 int cam_sync_unsubscribe_event(struct v4l2_fh *fh,
-		const struct v4l2_event_subscription *sub)
+	const struct v4l2_event_subscription *sub)
 {
 	if (!((sub->type == CAM_SYNC_V4L_EVENT) ||
 	(sub->type == CAM_SYNC_V4L_EVENT_V2))) {
@@ -2775,8 +2755,7 @@ static void cam_sync_configure_synx_obj(struct synx_register_params *object)
 static int cam_sync_component_bind(struct device *dev,
 	struct device *master_dev, void *data)
 {
-	int rc;
-	int idx;
+	int rc, idx;
 	struct platform_device *pdev = to_platform_device(dev);
 
 	sync_dev = kzalloc(sizeof(*sync_dev), GFP_KERNEL);

+ 25 - 22
drivers/cam_sync/cam_sync_api.h

@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #ifndef __CAM_SYNC_API_H__
@@ -20,11 +21,11 @@ typedef void (*sync_callback)(int32_t sync_obj, int status, void *data);
 /**
  * @brief: Creates a sync object
  *
- *  The newly created sync obj is assigned to sync_obj.
- *  sync object.
+ * The newly created sync obj is assigned to sync_obj.
+ * sync object.
  *
- * @param sync_obj   : Pointer to int referencing the sync object.
- * @param name : Optional parameter associating a name with the sync object for
+ * @param sync_obj : Pointer to int referencing the sync object.
+ * @param name     : Optional parameter associating a name with the sync object for
  * debug purposes. Only first SYNC_DEBUG_NAME_LEN bytes are accepted,
  * rest will be ignored.
  *
@@ -38,14 +39,13 @@ int cam_sync_create(int32_t *sync_obj, const char *name);
 /**
  * @brief: Registers a callback with a sync object
  *
- * @param cb_func:  Pointer to callback to be registered
- * @param userdata: Opaque pointer which will be passed back with callback.
- * @param sync_obj: int referencing the sync object.
+ * @param cb_func  :  Pointer to callback to be registered
+ * @param userdata : Opaque pointer which will be passed back with callback.
+ * @param sync_obj : int referencing the sync object.
  *
  * @return Status of operation. Zero in case of success.
  * -EINVAL will be returned if userdata is invalid.
  * -ENOMEM will be returned if cb_func is invalid.
- *
  */
 int cam_sync_register_callback(sync_callback cb_func,
 	void *userdata, int32_t sync_obj);
@@ -53,13 +53,14 @@ int cam_sync_register_callback(sync_callback cb_func,
 /**
  * @brief: De-registers a callback with a sync object
  *
- * @param cb_func:  Pointer to callback to be de-registered
- * @param userdata: Opaque pointer which will be passed back with callback.
- * @param sync_obj: int referencing the sync object.
+ * @param cb_func  :  Pointer to callback to be de-registered
+ * @param userdata : Opaque pointer which will be passed back with callback.
+ * @param sync_obj : int referencing the sync object.
  *
  * @return Status of operation. Zero in case of success.
  * -EINVAL will be returned if userdata is invalid.
  * -ENOMEM will be returned if cb_func is invalid.
+ * -ENOENT will be returned if call back not found
  */
 int cam_sync_deregister_callback(sync_callback cb_func,
 	void *userdata, int32_t sync_obj);
@@ -73,10 +74,10 @@ int cam_sync_deregister_callback(sync_callback cb_func,
  * is not guaranteed. The status parameter will indicate whether the entity
  * performing the signaling wants to convey an error case or a success case.
  *
- * @param sync_obj: int referencing the sync object.
- * @param status: Status of the signaling. Can be either SYNC_SIGNAL_ERROR or
+ * @param sync_obj  : int referencing the sync object.
+ * @param status    : Status of the signaling. Can be either SYNC_SIGNAL_ERROR or
  * SYNC_SIGNAL_SUCCESS.
- * @param evt_param: Event parameter
+ * @param evt_param : Event parameter
  *
  * @return Status of operation. Negative in case of error. Zero otherwise.
  */
@@ -87,8 +88,8 @@ int cam_sync_signal(int32_t sync_obj, uint32_t status, uint32_t evt_param);
  *
  * This function will merge multiple sync objects into a sync group.
  *
- * @param sync_obj: pointer to a block of ints to be merged
- * @param num_objs: Number of ints in the block
+ * @param sync_obj : pointer to a block of ints to be merged
+ * @param num_objs : Number of ints in the block
  *
  * @return Status of operation. Negative in case of error. Zero otherwise.
  */
@@ -133,11 +134,12 @@ int cam_sync_destroy(int32_t sync_obj);
  * of timeout_ms milliseconds. Must not be called from interrupt context as
  * this API can sleep. Should be called from process context only.
  *
- * @param sync_obj: int referencing the sync object to be waited upon
- * @timeout_ms sync_obj: Timeout in ms.
+ * @param sync_obj   : int referencing the sync object to be waited upon
+ * @param timeout_ms : Timeout in ms.
  *
- * @return 0 upon success, -EINVAL if sync object is in bad state or arguments
- * are invalid, -ETIMEDOUT if wait times out.
+ * @return Status of operation. Zero in case of success
+ * -EINVAL if sync object is in bad state or arguments are invalid
+ * -ETIMEDOUT if wait times out
  */
 int cam_sync_wait(int32_t sync_obj, uint64_t timeout_ms);
 
@@ -146,13 +148,14 @@ int cam_sync_wait(int32_t sync_obj, uint64_t timeout_ms);
  *
  * @param sync_obj: int referencing the sync object to be checked
  *
- * @return 0 upon success, -EINVAL if sync object is in bad state or arguments
- * are invalid
+ * @return Status of operation. Zero in case of success
+ * -EINVAL if sync object is in bad state or arguments are invalid
  */
 int cam_sync_check_valid(int32_t sync_obj);
 
 /**
  * @brief : API to register SYNC to platform framework.
+ *
  * @return struct platform_device pointer on on success, or ERR_PTR() on error.
  */
 int cam_sync_init(void);

+ 4 - 7
drivers/cam_sync/cam_sync_dma_fence.c

@@ -350,8 +350,7 @@ struct dma_fence *cam_dma_fence_get_fence_from_fd(
 int cam_dma_fence_register_cb(int32_t *sync_obj, int32_t *dma_fence_idx,
 	cam_sync_callback_for_dma_fence sync_cb)
 {
-	int rc = 0;
-	int dma_fence_row_idx = 0;
+	int rc = 0, dma_fence_row_idx;
 	struct cam_dma_fence_row *row = NULL;
 	struct dma_fence *dma_fence = NULL;
 
@@ -403,7 +402,7 @@ int cam_dma_fence_register_cb(int32_t *sync_obj, int32_t *dma_fence_idx,
 		CAM_WARN(CAM_DMA_FENCE,
 			"dma fence at idx: %d fd: %d seqno: %llu has already registered a cb for sync: %d - same fd for 2 fences?",
 			dma_fence_row_idx, row->fd, dma_fence->seqno, row->sync_obj);
-		goto end;
+		goto monitor_dump;
 	}
 
 	rc = dma_fence_add_callback(row->fence, &row->fence_cb,
@@ -432,8 +431,6 @@ int cam_dma_fence_register_cb(int32_t *sync_obj, int32_t *dma_fence_idx,
 
 monitor_dump:
 	__cam_dma_fence_dump_monitor_array(dma_fence_row_idx);
-
-end:
 	spin_unlock_bh(&g_cam_dma_fence_dev->row_spinlocks[dma_fence_row_idx]);
 	return rc;
 }
@@ -496,11 +493,11 @@ int cam_dma_fence_internal_signal(
 	}
 
 	if (row->state == CAM_DMA_FENCE_STATE_SIGNALED) {
-		spin_unlock_bh(&g_cam_dma_fence_dev->row_spinlocks[dma_fence_row_idx]);
 		CAM_WARN(CAM_DMA_FENCE,
 			"dma fence fd: %d[seqno: %llu] already in signaled state",
 			signal_dma_fence->dma_fence_fd, dma_fence->seqno);
-		return 0;
+		rc = 0;
+		goto monitor_dump;
 	}
 
 	if (test_bit(CAM_GENERIC_FENCE_TYPE_DMA_FENCE, &cam_sync_monitor_mask))

+ 4 - 4
drivers/cam_sync/cam_sync_private.h

@@ -69,13 +69,13 @@
  * dumps on any error, to explicitly trigger a dump on every fence release
  * below BIT(fence_type_dump) needs to be used at the same time
  */
-#define CAM_GENERIC_FENCE_DUMP         0x10
+#define CAM_GENERIC_FENCE_DUMP_ALWAYS   0x10
 #define CAM_GENERIC_FENCE_TYPE_SYNC_OBJ_DUMP \
-	(CAM_GENERIC_FENCE_TYPE_SYNC_OBJ + (CAM_GENERIC_FENCE_DUMP))
+	(CAM_GENERIC_FENCE_TYPE_SYNC_OBJ + (CAM_GENERIC_FENCE_DUMP_ALWAYS))
 #define CAM_GENERIC_FENCE_TYPE_DMA_FENCE_DUMP \
-	(CAM_GENERIC_FENCE_TYPE_DMA_FENCE + (CAM_GENERIC_FENCE_DUMP))
+	(CAM_GENERIC_FENCE_TYPE_DMA_FENCE + (CAM_GENERIC_FENCE_DUMP_ALWAYS))
 #define CAM_GENERIC_FENCE_TYPE_SYNX_OBJ_DUMP \
-	(CAM_GENERIC_FENCE_TYPE_SYNX_OBJ + (CAM_GENERIC_FENCE_DUMP))
+	(CAM_GENERIC_FENCE_TYPE_SYNX_OBJ + (CAM_GENERIC_FENCE_DUMP_ALWAYS))
 
 /**
  * enum sync_type - Enum to indicate the type of sync object,

+ 16 - 13
drivers/cam_sync/cam_sync_synx.c

@@ -276,10 +276,12 @@ static int __cam_synx_obj_release(int32_t row_idx)
 			spin_unlock_bh(&g_cam_synx_obj_dev->row_spinlocks[row_idx]);
 			rc = __cam_synx_deregister_cb_util(synx_hdl, row);
 			spin_lock_bh(&g_cam_synx_obj_dev->row_spinlocks[row_idx]);
-			if (rc)
+			if (rc) {
 				CAM_DBG(CAM_SYNX,
 					"Failed to deregister cb for synx hdl: %u rc: %d",
 					synx_hdl, rc);
+				__cam_synx_obj_dump_monitor_array(row_idx);
+			}
 		}
 	}
 
@@ -346,8 +348,7 @@ static void __cam_synx_obj_init_row(uint32_t idx, const char *name,
 static int __cam_synx_obj_release_row(int32_t row_idx)
 {
 	if ((row_idx < 0) || (row_idx >= CAM_SYNX_MAX_OBJS)) {
-		CAM_ERR(CAM_SYNX, "synx row idx: %d is invalid",
-			row_idx);
+		CAM_ERR(CAM_SYNX, "synx row idx: %d is invalid", row_idx);
 		return -EINVAL;
 	}
 
@@ -539,18 +540,16 @@ int cam_synx_obj_internal_signal(int32_t row_idx,
 	if (row->state != CAM_SYNX_OBJ_STATE_ACTIVE) {
 		CAM_ERR(CAM_SYNX, "synx obj: %u not in right state: %d to signal",
 			signal_synx_obj->synx_obj, row->state);
-		__cam_synx_obj_dump_monitor_array(row_idx);
-		spin_unlock_bh(&g_cam_synx_obj_dev->row_spinlocks[row_idx]);
-		return -EINVAL;
+		rc = -EINVAL;
+		goto monitor_dump;
 	}
 
 	if (row->synx_obj != signal_synx_obj->synx_obj) {
 		CAM_WARN(CAM_SYNX,
 			"Trying to signal synx obj: %u in row: %u having a different synx obj: %u",
 			signal_synx_obj->synx_obj, row_idx, row->synx_obj);
-		__cam_synx_obj_dump_monitor_array(row_idx);
-		spin_unlock_bh(&g_cam_synx_obj_dev->row_spinlocks[row_idx]);
-		return 0;
+		rc = 0;
+		goto monitor_dump;
 	}
 
 	rc = __cam_synx_obj_map_sync_status_util(signal_synx_obj->status, &signal_status);
@@ -578,9 +577,10 @@ int cam_synx_obj_internal_signal(int32_t row_idx,
 	if (deregister_cb) {
 		rc = __cam_synx_deregister_cb_util(signal_synx_obj->synx_obj, row);
 		if (rc) {
+			spin_lock_bh(&g_cam_synx_obj_dev->row_spinlocks[row_idx]);
 			CAM_ERR(CAM_SYNX, "Failed to deregister cb for synx: %u rc: %d",
 				signal_synx_obj->synx_obj, rc);
-			goto end;
+			goto monitor_dump;
 		}
 	}
 
@@ -594,6 +594,11 @@ int cam_synx_obj_internal_signal(int32_t row_idx,
 	CAM_DBG(CAM_SYNX, "synx obj: %d signaled with status: %d rc: %d",
 		signal_synx_obj->synx_obj, signal_status, rc);
 
+	return rc;
+
+monitor_dump:
+	__cam_synx_obj_dump_monitor_array(row_idx);
+	spin_unlock_bh(&g_cam_synx_obj_dev->row_spinlocks[row_idx]);
 end:
 	return rc;
 }
@@ -678,7 +683,7 @@ int cam_synx_obj_register_cb(int32_t *sync_obj, int32_t row_idx,
 		CAM_WARN(CAM_SYNX,
 			"synx obj at idx: %d handle: %d has already registered a cb for sync: %d",
 			row_idx, row->synx_obj, row->sync_obj);
-		goto end;
+		goto monitor_dump;
 	}
 
 	row->sync_cb = sync_cb;
@@ -712,7 +717,6 @@ int cam_synx_obj_register_cb(int32_t *sync_obj, int32_t row_idx,
 
 monitor_dump:
 	__cam_synx_obj_dump_monitor_array(row_idx);
-end:
 	spin_unlock_bh(&g_cam_synx_obj_dev->row_spinlocks[row_idx]);
 	return rc;
 }
@@ -762,7 +766,6 @@ void cam_synx_obj_close(void)
 
 	mutex_lock(&g_cam_synx_obj_dev->dev_lock);
 	for (i = 0; i < CAM_SYNX_MAX_OBJS; i++) {
-
 		row = &g_cam_synx_obj_dev->rows[i];
 		if (row->state == CAM_SYNX_OBJ_STATE_INVALID)
 			continue;

+ 4 - 3
drivers/cam_sync/cam_sync_synx.h

@@ -102,7 +102,8 @@ int cam_synx_obj_internal_signal(int32_t row_idx,
  * @param synx_obj : New synx obj handle
  * @param row_idx  : Imported obj table row idx
  *
- * @return 0 upon success, -EINVAL if synx object is bad state
+ * @return Status of operation. Zero in case of success
+ * -EINVAL if synx object is bad state
  */
 int cam_synx_obj_import_dma_fence(const char *name, uint32_t flags, void *fence,
 	uint32_t *synx_obj, int32_t *row_idx);
@@ -112,7 +113,7 @@ int cam_synx_obj_import_dma_fence(const char *name, uint32_t flags, void *fence,
  *
  * @param release_params : Synx obj release info
  *
- * @return 0 upon success, negative value otherwise
+ * @return Status of operation. Zero upon success. Negative value otherwise
  */
 int cam_synx_obj_release(struct cam_synx_obj_release_params *release_params);
 
@@ -121,7 +122,7 @@ int cam_synx_obj_release(struct cam_synx_obj_release_params *release_params);
  *
  * @param signal_synx_obj : Signal info
  *
- * @return 0 upon success, negative value otherwise
+ * @return Status of operation. Zero upon success. Negative value otherwise
  */
 int cam_synx_obj_signal_obj(struct cam_synx_obj_signal *signal_synx_obj);