msm: synx: acquire mutex through loop index

Acquire the mutex during cleanup from the loop index
rather than the index saved in the synx object as
it could lead to potential deadlock with object
allocation.

Change-Id: I2bc84b67dd039521053f000e2d1715339789f5e1
Signed-off-by: Sumukh Hallymysore Ravindra <shallymy@codeaurora.org>
diff --git a/drivers/media/platform/msm/synx/synx.c b/drivers/media/platform/msm/synx/synx.c
index eb467c0..cd6795c 100644
--- a/drivers/media/platform/msm/synx/synx.c
+++ b/drivers/media/platform/msm/synx/synx.c
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
  */
 #define pr_fmt(fmt) "synx: " fmt
 
@@ -1327,7 +1327,7 @@
 		struct synx_table_row *row =
 			synx_dev->synx_table + i;
 
-		mutex_lock(&synx_dev->row_locks[row->index]);
+		mutex_lock(&synx_dev->row_locks[i]);
 		if (row->index) {
 			list_for_each_entry_safe(payload_info,
 				temp_payload_info,
@@ -1339,7 +1339,7 @@
 				}
 			}
 		}
-		mutex_unlock(&synx_dev->row_locks[row->index]);
+		mutex_unlock(&synx_dev->row_locks[i]);
 	}
 }