Skip to content

Commit 2f2d444

Browse files
lukaszluba-armgregkh
authored andcommitted
PM / devfreq: Unlock mutex and free devfreq struct in error path
commit 8b50a79 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e0b3258 commit 2f2d444

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
@@ -788,7 +788,8 @@ struct devfreq *devfreq_add_device(struct device *dev,
788788

789789
if (devfreq->profile->timer < 0
790790
|| devfreq->profile->timer >= DEVFREQ_TIMER_NUM) {
791-
goto err_out;
791+
mutex_unlock(&devfreq->lock);
792+
goto err_dev;
792793
}
793794

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

0 commit comments

Comments
 (0)