PM / devfreq: Unlock mutex and free devfreq struct in error path
commit8b50a79957upstream. 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:4dc3bab868("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>
This commit is contained in:
parent
e0b325888b
commit
2f2d444ac4
1 changed files with 2 additions and 1 deletions
|
|
@ -788,7 +788,8 @@ struct devfreq *devfreq_add_device(struct device *dev,
|
|||
|
||||
if (devfreq->profile->timer < 0
|
||||
|| devfreq->profile->timer >= DEVFREQ_TIMER_NUM) {
|
||||
goto err_out;
|
||||
mutex_unlock(&devfreq->lock);
|
||||
goto err_dev;
|
||||
}
|
||||
|
||||
if (!devfreq->profile->max_state && !devfreq->profile->freq_table) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue