Skip to content

Commit e1dccb4

Browse files
haruki3hhhBartosz Golaszewski
authored andcommitted
power: sequencing: fix missing state_lock in pwrseq_power_on() error path
pwrseq_power_on() calls pwrseq_unit_disable() when the post_enable callback fails. However, this call is outside the scoped_guard(mutex, &pwrseq->state_lock) block that ends. pwrseq_unit_disable() has lockdep_assert_held(&pwrseq->state_lock), which will fail when called from this error path. Add the scoped_guard block to cover the post_enable callback and its error handling to ensure the lock is held when pwrseq_unit_disable() is called. Signed-off-by: Ziyi Guo <n7l8m4@u.northwestern.edu> Link: https://patch.msgid.link/20260130182651.1576579-1-n7l8m4@u.northwestern.edu Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
1 parent 52e7b5b commit e1dccb4

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

  • drivers/power/sequencing

drivers/power/sequencing/core.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -914,8 +914,10 @@ int pwrseq_power_on(struct pwrseq_desc *desc)
914914
if (target->post_enable) {
915915
ret = target->post_enable(pwrseq);
916916
if (ret) {
917-
pwrseq_unit_disable(pwrseq, unit);
918-
desc->powered_on = false;
917+
scoped_guard(mutex, &pwrseq->state_lock) {
918+
pwrseq_unit_disable(pwrseq, unit);
919+
desc->powered_on = false;
920+
}
919921
}
920922
}
921923

0 commit comments

Comments
 (0)