aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/devfreq
diff options
context:
space:
mode:
authorLukasz Luba <lukasz.luba@arm.com>2021-03-15 09:31:23 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-05-14 09:49:58 +0200
commit2f2d444ac4964ddd489090b16cc8ab2b06cbca04 (patch)
tree26814c6c9887dd8dda306763f11a44439033eae2 /drivers/devfreq
parente0b325888b53e7e63e6085588b7736e7e778e0df (diff)
downloadkernel_replicant_linux-2f2d444ac4964ddd489090b16cc8ab2b06cbca04.tar.gz
kernel_replicant_linux-2f2d444ac4964ddd489090b16cc8ab2b06cbca04.tar.bz2
kernel_replicant_linux-2f2d444ac4964ddd489090b16cc8ab2b06cbca04.zip
PM / devfreq: Unlock mutex and free devfreq struct in error path
commit 8b50a7995770d41a2e8d9c422cd2882aca0dedd2 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: 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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 861c100f9fac..1db04cbcf227 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -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) {