Commit 2eb57983 authored by Chanwoo Choi's avatar Chanwoo Choi Committed by Ben Hutchings

PM / devfreq: Fix the bug of devfreq_add_device when governor is NULL

commit 73613b16 upstream.

This patch fixes the bug of devfreq_add_device(). The devfreq device must
have the default governor. If find_devfreq_governor() returns error,
devfreq_add_device() fail to add the devfreq instance.

Fixes: 1b5c1be2 (PM / devfreq: map devfreq drivers to governor using name)
Signed-off-by: default avatarChanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 0d462d9e
...@@ -502,11 +502,16 @@ struct devfreq *devfreq_add_device(struct device *dev, ...@@ -502,11 +502,16 @@ struct devfreq *devfreq_add_device(struct device *dev,
list_add(&devfreq->node, &devfreq_list); list_add(&devfreq->node, &devfreq_list);
governor = find_devfreq_governor(devfreq->governor_name); governor = find_devfreq_governor(devfreq->governor_name);
if (!IS_ERR(governor)) if (IS_ERR(governor)) {
dev_err(dev, "%s: Unable to find governor for the device\n",
__func__);
err = PTR_ERR(governor);
goto err_init;
}
devfreq->governor = governor; devfreq->governor = governor;
if (devfreq->governor) err = devfreq->governor->event_handler(devfreq, DEVFREQ_GOV_START,
err = devfreq->governor->event_handler(devfreq, NULL);
DEVFREQ_GOV_START, NULL);
if (err) { if (err) {
dev_err(dev, "%s: Unable to start governor for the device\n", dev_err(dev, "%s: Unable to start governor for the device\n",
__func__); __func__);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment