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

Commit cfbe993d authored by Zhen Kong's avatar Zhen Kong Committed by Gerrit - the friendly Code Review server
Browse files

qseecom: decrease clk_access_cnt



When scm_call returns EBUSY and app_access_lock is released,
clk_access_cnt could be larger than 2 as a new qseecom thread
may come to increase clk_access_cnt in this situation. So
clk_access_cnt should be always decreased.

Change-Id: I2400e807b9f15e3d7d8caad6978bfa93aa3cdd76
Signed-off-by: default avatarZhen Kong <zkong@codeaurora.org>
parent 7dcd447f
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -1778,20 +1778,17 @@ static int __qseecom_decrease_clk_ref_count(enum qseecom_ce_hw_instance ce)
	else
		qclk = &qseecom.ce_drv;

	if (qclk->clk_access_cnt > 2) {
	if (qclk->clk_access_cnt > 0) {
		qclk->clk_access_cnt--;
	} else {
		pr_err("Invalid clock ref count %d\n", qclk->clk_access_cnt);
		ret = -EINVAL;
		goto err_dec_ref_cnt;
	}
	if (qclk->clk_access_cnt == 2)
		qclk->clk_access_cnt--;

err_dec_ref_cnt:
	mutex_unlock(&clk_access_lock);
	return ret;
}


static int qseecom_scale_bus_bandwidth_timer(uint32_t mode)
{
	int32_t ret = 0;