Skip to content

Commit 8b50a79

Browse files
lukaszluba-armchanwoochoi
authored andcommitted
PM / devfreq: Unlock mutex and free devfreq struct in error path
The devfreq->lock is held for time of setup. Release the lock in the error path, before jumping to the end of the function. Change the goto destination which frees the allocated memory. Cc: v5.9+ <stable@vger.kernel.org> # v5.9+ Fixes: 4dc3bab ("PM / devfreq: Add support delayed timer for polling mode") Signed-off-by: Lukasz Luba <lukasz.luba@arm.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
1 parent 75d1b0b commit 8b50a79

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎drivers/devfreq/devfreq.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,8 @@ struct devfreq *devfreq_add_device(struct device *dev,
822822

823823
if (devfreq->profile->timer < 0
824824
|| devfreq->profile->timer >= DEVFREQ_TIMER_NUM) {
825-
goto err_out;
825+
mutex_unlock(&devfreq->lock);
826+
goto err_dev;
826827
}
827828

828829
if (!devfreq->profile->max_state && !devfreq->profile->freq_table) {

0 commit comments

Comments
 (0)