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

Commit 22efcf6c authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "spcom: use mutex on spcom_unlock_ion_buf()"

parents cf8fb0ea b4968ee8
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -1723,12 +1723,16 @@ static int spcom_handle_lock_ion_buf_command(struct spcom_channel *ch,

	pr_debug("ion handle ok.\n");

	/* ION buf lock doesn't involve any rx/tx data to SP. */
	mutex_lock(&ch->lock);

	/* Check if this ION buffer is already locked */
	for (i = 0 ; i < ARRAY_SIZE(ch->ion_handle_table) ; i++) {
		if (ch->ion_handle_table[i] == ion_handle) {
			pr_err("fd [%d] ion buf is already locked.\n", fd);
			/* decrement back the ref count */
			ion_free(spcom_dev->ion_client, ion_handle);
			mutex_unlock(&ch->lock);
			return -EINVAL;
		}
	}
@@ -1740,6 +1744,7 @@ static int spcom_handle_lock_ion_buf_command(struct spcom_channel *ch,
			ch->ion_fd_table[i] = fd;
			pr_debug("ch [%s] locked ion buf #%d, fd [%d].\n",
				ch->name, i, fd);
			mutex_unlock(&ch->lock);
			return 0;
		}
	}
@@ -1748,6 +1753,8 @@ static int spcom_handle_lock_ion_buf_command(struct spcom_channel *ch,
	/* decrement back the ref count */
	ion_free(spcom_dev->ion_client, ion_handle);

	mutex_unlock(&ch->lock);

	return -EFAULT;
}

@@ -1826,8 +1833,13 @@ static int spcom_handle_unlock_ion_buf_command(struct spcom_channel *ch,
		return -EINVAL;
	}

	/* ION buf unlock doesn't involve any rx/tx data to SP. */
	mutex_lock(&ch->lock);

	ret = spcom_unlock_ion_buf(ch, fd);

	mutex_unlock(&ch->lock);

	return ret;
}