summaryrefslogtreecommitdiffstats
path: root/drivers/devfreq
diff options
context:
space:
mode:
authorLukasz Luba <lukasz.luba@arm.com>2021-03-15 10:31:23 +0100
committerChanwoo Choi <cw00.choi@samsung.com>2021-04-08 06:14:45 +0200
commit8b50a7995770d41a2e8d9c422cd2882aca0dedd2 (patch)
tree9b6462200080e5b209c9f8831c96b9065761c14f /drivers/devfreq
parentMerge branch 'immutable-devfreq-v5.13-rc1' into devfreq-next (diff)
downloadlinux-8b50a7995770d41a2e8d9c422cd2882aca0dedd2.tar.xz
linux-8b50a7995770d41a2e8d9c422cd2882aca0dedd2.zip
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: 4dc3bab8687f ("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>
Diffstat (limited to 'drivers/devfreq')
-rw-r--r--drivers/devfreq/devfreq.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index b6d3e7db0b09..99b2eeedc238 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -822,7 +822,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) {