aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/devfreq/devfreq.c
diff options
context:
space:
mode:
authorMyungJoo Ham <myungjoo.ham@samsung.com>2015-10-01 23:39:23 -0400
committerMyungJoo Ham <myungjoo.ham@samsung.com>2016-06-22 00:51:08 -0400
commit3e1d7fb0d279fea19eb4e36cc9bddf89264ba03f (patch)
tree52c99f6ff840b7cd78a744e183cd2991f7add3b8 /drivers/devfreq/devfreq.c
parent33688abb2802ff3a230bd2441f765477b94cc89e (diff)
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>
Diffstat (limited to 'drivers/devfreq/devfreq.c')
-rw-r--r--drivers/devfreq/devfreq.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 1d6c803804d5..380173738a1d 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -561,15 +561,6 @@ struct devfreq *devfreq_add_device(struct device *dev,
561 mutex_lock(&devfreq->lock); 561 mutex_lock(&devfreq->lock);
562 } 562 }
563 563
564 devfreq->trans_table = devm_kzalloc(dev, sizeof(unsigned int) *
565 devfreq->profile->max_state *
566 devfreq->profile->max_state,
567 GFP_KERNEL);
568 devfreq->time_in_state = devm_kzalloc(dev, sizeof(unsigned long) *
569 devfreq->profile->max_state,
570 GFP_KERNEL);
571 devfreq->last_stat_updated = jiffies;
572
573 dev_set_name(&devfreq->dev, "%s", dev_name(dev)); 564 dev_set_name(&devfreq->dev, "%s", dev_name(dev));
574 err = device_register(&devfreq->dev); 565 err = device_register(&devfreq->dev);
575 if (err) { 566 if (err) {
@@ -578,6 +569,15 @@ struct devfreq *devfreq_add_device(struct device *dev,
578 goto err_out; 569 goto err_out;
579 } 570 }
580 571
572 devfreq->trans_table = devm_kzalloc(&devfreq->dev, sizeof(unsigned int) *
573 devfreq->profile->max_state *
574 devfreq->profile->max_state,
575 GFP_KERNEL);
576 devfreq->time_in_state = devm_kzalloc(&devfreq->dev, sizeof(unsigned long) *
577 devfreq->profile->max_state,
578 GFP_KERNEL);
579 devfreq->last_stat_updated = jiffies;
580
581 srcu_init_notifier_head(&devfreq->transition_notifier_list); 581 srcu_init_notifier_head(&devfreq->transition_notifier_list);
582 582
583 mutex_unlock(&devfreq->lock); 583 mutex_unlock(&devfreq->lock);