summaryrefslogtreecommitdiff
path: root/drivers/devfreq
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2016-09-29 10:13:28 +0800
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-10-11 00:00:20 +0200
commit0f376c9cd86c23f37312d37748b233660ef9d9af (patch)
treeefa46f8cb94cf7e906ebfed2401d6cc34e0e1be9 /drivers/devfreq
parent3b91f4b361daad1f3e1c60ca5a7861e8b36f9728 (diff)
downloadlwn-0f376c9cd86c23f37312d37748b233660ef9d9af.tar.gz
lwn-0f376c9cd86c23f37312d37748b233660ef9d9af.zip
PM / devfreq: Add proper locking around list_del()
Use devfreq_list_lock around list_del() to prevent list corruption. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/devfreq')
-rw-r--r--drivers/devfreq/devfreq.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 478006b7764a..66d3c7184a0f 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -594,17 +594,19 @@ struct devfreq *devfreq_add_device(struct device *dev,
if (devfreq->governor)
err = devfreq->governor->event_handler(devfreq,
DEVFREQ_GOV_START, NULL);
- mutex_unlock(&devfreq_list_lock);
if (err) {
dev_err(dev, "%s: Unable to start governor for the device\n",
__func__);
goto err_init;
}
+ mutex_unlock(&devfreq_list_lock);
return devfreq;
err_init:
list_del(&devfreq->node);
+ mutex_unlock(&devfreq_list_lock);
+
device_unregister(&devfreq->dev);
err_out:
return ERR_PTR(err);