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

Commit f1441eef authored by David Dai's avatar David Dai
Browse files

interconnect: qcom: Prevent duplicate BCMs being added to commit list



Having the same node being added to bcm voter commit list will result
in an infinite loop when walking through the list. Prevent the same
node from being added multiple times by checking bcm->list and
clean up commit list after sending the commands to RPMh.

Change-Id: Ie210437df43efd537bdcb0143b03423964ac3840
Signed-off-by: default avatarDavid Dai <daidavid1@codeaurora.org>
parent d9f515c2
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -211,6 +211,7 @@ void qcom_icc_bcm_voter_add(struct bcm_voter *voter, struct qcom_icc_bcm *bcm)
		return;

	mutex_lock(&voter->lock);
	if (list_empty(&bcm->list))
		list_add_tail(&bcm->list, &voter->commit_list);

	if (list_empty(&bcm->ws_list))
@@ -280,6 +281,9 @@ int qcom_icc_bcm_voter_commit(struct bcm_voter *voter)
		goto out;
	}

	list_for_each_entry_safe(bcm, bcm_tmp, &voter->commit_list, list)
		list_del_init(&bcm->list);

	INIT_LIST_HEAD(&voter->commit_list);

	list_for_each_entry_safe(bcm, bcm_tmp, &voter->ws_list, ws_list) {
@@ -322,6 +326,9 @@ int qcom_icc_bcm_voter_commit(struct bcm_voter *voter)
	}

out:
	list_for_each_entry_safe(bcm, bcm_tmp, &voter->commit_list, list)
		list_del_init(&bcm->list);

	INIT_LIST_HEAD(&voter->commit_list);
	mutex_unlock(&voter->lock);
	return ret;