mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-10 12:57:06 +09:00
UPSTREAM: PM / devfreq: devm_kzalloc to have dev pointer more precisely
devm_kzalloc of devfreq's statistics data structure has been
using its parent device as the dev allocated for.
If a device's devfreq is disabled in run-time,
such allocated memory won't be freed.
Desginating more precisely with the devfreq device
pointer fixes the issue.
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
(cherry picked from commit 3e1d7fb0d2)
Change-Id: I657d7d43e6b7e82cce1c57267ee81b0ab45c0965
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
This commit is contained in:
@@ -564,15 +564,6 @@ struct devfreq *devfreq_add_device(struct device *dev,
|
||||
mutex_lock(&devfreq->lock);
|
||||
}
|
||||
|
||||
devfreq->trans_table = devm_kzalloc(dev, sizeof(unsigned int) *
|
||||
devfreq->profile->max_state *
|
||||
devfreq->profile->max_state,
|
||||
GFP_KERNEL);
|
||||
devfreq->time_in_state = devm_kzalloc(dev, sizeof(unsigned long) *
|
||||
devfreq->profile->max_state,
|
||||
GFP_KERNEL);
|
||||
devfreq->last_stat_updated = jiffies;
|
||||
|
||||
dev_set_name(&devfreq->dev, "%s", dev_name(dev));
|
||||
err = device_register(&devfreq->dev);
|
||||
if (err) {
|
||||
@@ -581,6 +572,15 @@ struct devfreq *devfreq_add_device(struct device *dev,
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
devfreq->trans_table = devm_kzalloc(&devfreq->dev, sizeof(unsigned int) *
|
||||
devfreq->profile->max_state *
|
||||
devfreq->profile->max_state,
|
||||
GFP_KERNEL);
|
||||
devfreq->time_in_state = devm_kzalloc(&devfreq->dev, sizeof(unsigned long) *
|
||||
devfreq->profile->max_state,
|
||||
GFP_KERNEL);
|
||||
devfreq->last_stat_updated = jiffies;
|
||||
|
||||
srcu_init_notifier_head(&devfreq->transition_notifier_list);
|
||||
|
||||
mutex_unlock(&devfreq->lock);
|
||||
|
||||
Reference in New Issue
Block a user