PM / devfreq: unlock mutex and free devfreq struct in error path
PATCH 1/1 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.
--- drivers/devfreq/devfreq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/devfreq/devfreq.c +2 -1
@@ -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) {
Signature · 1 line
2.17.1
Chanwoo Choi
maintainerHi Lukasz,
Quoted 16 lines · Lukasz Luba
The
devfreq->lockis 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.
Signed-off-by Lukasz Luba <[email protected]>--- drivers/devfreq/devfreq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/devfreq/devfreq.c +0
-0
drivers/devfreq/devfreq.c struct devfreq *devfreq_add_device(struct device *dev, · line 829
Quoted 9 lines
drivers/devfreq/devfreq.c +2
-1@@ -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) {
Looks good to me. But, need to add the following information
and please use capital letter of the first character of patch title. Thanks.
Also, need to send it to stable lkml.
Signature · 3 lines
Best Regards, Chanwoo Choi Samsung Electronics
Hi Chanwoo,
Quoted 26 lines · Chanwoo Choi
Hi Lukasz,
Quoted 23 lines · Lukasz Luba
The
devfreq->lockis 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.
Signed-off-by Lukasz Luba <[email protected]>--- drivers/devfreq/devfreq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/devfreq/devfreq.c +2
-1@@ -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; }
Quoted 5 lines
drivers/devfreq/devfreq.c struct devfreq *devfreq_add_device(struct device *dev, · line 829
Quoted 2 lines
drivers/devfreq/devfreq.c +0
-0if (!devfreq->profile->max_state && !devfreq->profile->freq_table) {Looks good to me. But, need to add the following information
and please use capital letter of the first character of patch title. Thanks.
thanks for looking at this, sure, I'll use the capital letter.
Quoted 5 lines
Fixes 4dc3bab8687f ("PM / devfreq: Add support delayed timer for polling mode")Also, need to send it to stable lkml.
I'll add the 'Fixes' tag and send v2 also into stable v5.8+:
Regards,
Lukasz