summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJonghwa Lee <jonghwa3.lee@samsung.com>2015-08-03 19:17:16 +0900
committerSeung-Woo Kim <sw0312.kim@samsung.com>2016-12-14 13:47:01 +0900
commit160348d634389f496695541d76d3c64599fb88fc (patch)
treed95b18d62a1d8524115af6e472577805e8ebd827 /drivers
parentcef849faef297e99f0922da505f87aea7c77d3b6 (diff)
thermal: devfreq_cooling: Return the max cooling state correctly.
After initialization with prebuilt opp table, max_state value is not correct. This patch fixes it. Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/thermal/devfreq_cooling.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/thermal/devfreq_cooling.c b/drivers/thermal/devfreq_cooling.c
index 4c36684b019e..fb2c0654fa7d 100644
--- a/drivers/thermal/devfreq_cooling.c
+++ b/drivers/thermal/devfreq_cooling.c
@@ -188,6 +188,8 @@ __devfreq_cooling_register(struct device_node *np, struct devfreq *devfreq)
}
rcu_read_unlock();
+ devfreq_dev->max_state -= 1;
+
/*
* Use the freq_table of devfreq_dev_profile structure
* if the devfreq_dev_profile includes already filled frequency table.
@@ -200,13 +202,12 @@ __devfreq_cooling_register(struct device_node *np, struct devfreq *devfreq)
/* Allocate the frequency table and fill it */
rcu_read_lock();
devfreq_dev->freq_table = kzalloc(sizeof(*devfreq_dev->freq_table) *
- devfreq_dev->max_state, GFP_KERNEL);
+ devfreq_dev->max_state + 1, GFP_KERNEL);
if (!devfreq_dev->freq_table) {
rcu_read_unlock();
cool_dev = ERR_PTR(-ENOMEM);
goto free_cdev;
}
- devfreq_dev->max_state -= 1;
freq = ULONG_MAX;
for (i = 0; i <= devfreq_dev->max_state; i++, freq--) {