Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0110b73b authored by Ram Nagesh's avatar Ram Nagesh
Browse files

msm: synx: protect clean up with mutex lock



While cleaning up synx table entry, hold the lock for that particular
entry. This will make sure that any other read/write for same entry waits
till cleaning is done.

Also, Change log level of empty table entries from warning to debug.

Change-Id: Ib092f41a12fb943ed184c031dca481a75d3446e3
Signed-off-by: default avatarRam Nagesh <quic_ramnages@quicinc.com>
parent e0b641d7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -67,14 +67,14 @@ static ssize_t synx_table_read(struct file *file,
	if (columns & STATE_COLUMN)
		cur += scnprintf(cur, end - cur, "|  Status  |");
	cur += scnprintf(cur, end - cur, "\n");
	for (i = 0; i < SYNX_MAX_OBJS; i++) {
	for (i = 1; i < SYNX_MAX_OBJS; i++) {
		row = &dev->synx_table[i];

		index = row->index;
		mutex_lock(&dev->row_locks[index]);
		if (!row->index) {
			mutex_unlock(&dev->row_locks[index]);
			pr_warn("synx obj at %d invalid\n", index);
			pr_debug("synx obj at %d invalid\n", index);
			continue;
		}

+2 −0
Original line number Diff line number Diff line
@@ -252,7 +252,9 @@ int synx_deinit_object(struct synx_table_row *row)
		}
	}

	mutex_lock(&synx_dev->row_locks[index]);
	memset(row, 0, sizeof(*row));
	mutex_unlock(&synx_dev->row_locks[index]);
	clear_bit(index, synx_dev->bitmap);

	pr_debug("destroying synx obj at %d successful\n", index);