mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 20:33:58 -04:00
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: David Dai <daidavid1@codeaurora.org>
This commit is contained in:
parent
d9f515c2b6
commit
f1441eef72
1 changed files with 8 additions and 1 deletions
|
|
@ -211,7 +211,8 @@ void qcom_icc_bcm_voter_add(struct bcm_voter *voter, struct qcom_icc_bcm *bcm)
|
|||
return;
|
||||
|
||||
mutex_lock(&voter->lock);
|
||||
list_add_tail(&bcm->list, &voter->commit_list);
|
||||
if (list_empty(&bcm->list))
|
||||
list_add_tail(&bcm->list, &voter->commit_list);
|
||||
|
||||
if (list_empty(&bcm->ws_list))
|
||||
list_add_tail(&bcm->ws_list, &voter->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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue