diff options
author | Chanwoo Choi <cw00.choi@samsung.com> | 2016-12-28 06:52:35 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-01-26 02:24:44 -0500 |
commit | ebdfcaa14eef97ae0711823524fd8c8865c05933 (patch) | |
tree | 52773b2e39d753580d82e50ab576e95c4cf5943d | |
parent | 7959835473173638527f3d294fcccb1b1697bd92 (diff) |
PM / devfreq: Fix the bug of devfreq_add_device when governor is NULL
commit 73613b16cb5c5d5a659fc8832eff99eead3f9afb 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: 1b5c1be2c88e (PM / devfreq: map devfreq drivers to governor using name)
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/devfreq/devfreq.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index bf3ea7603a58..712592cef1a2 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c | |||
@@ -593,11 +593,16 @@ struct devfreq *devfreq_add_device(struct device *dev, | |||
593 | list_add(&devfreq->node, &devfreq_list); | 593 | list_add(&devfreq->node, &devfreq_list); |
594 | 594 | ||
595 | governor = find_devfreq_governor(devfreq->governor_name); | 595 | governor = find_devfreq_governor(devfreq->governor_name); |
596 | if (!IS_ERR(governor)) | 596 | if (IS_ERR(governor)) { |
597 | devfreq->governor = governor; | 597 | dev_err(dev, "%s: Unable to find governor for the device\n", |
598 | if (devfreq->governor) | 598 | __func__); |
599 | err = devfreq->governor->event_handler(devfreq, | 599 | err = PTR_ERR(governor); |
600 | DEVFREQ_GOV_START, NULL); | 600 | goto err_init; |
601 | } | ||
602 | |||
603 | devfreq->governor = governor; | ||
604 | err = devfreq->governor->event_handler(devfreq, DEVFREQ_GOV_START, | ||
605 | NULL); | ||
601 | if (err) { | 606 | if (err) { |
602 | dev_err(dev, "%s: Unable to start governor for the device\n", | 607 | dev_err(dev, "%s: Unable to start governor for the device\n", |
603 | __func__); | 608 | __func__); |