Commit e1dccb48 authored by Ziyi Guo's avatar Ziyi Guo Committed by Bartosz Golaszewski
Browse files

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: default avatarZiyi Guo <n7l8m4@u.northwestern.edu>
Link: https://patch.msgid.link/20260130182651.1576579-1-n7l8m4@u.northwestern.edu


Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
parent 52e7b5bd
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -914,10 +914,12 @@ int pwrseq_power_on(struct pwrseq_desc *desc)
	if (target->post_enable) {
		ret = target->post_enable(pwrseq);
		if (ret) {
			scoped_guard(mutex, &pwrseq->state_lock) {
				pwrseq_unit_disable(pwrseq, unit);
				desc->powered_on = false;
			}
		}
	}

	return ret;
}