summaryrefslogtreecommitdiff
path: root/drivers/devfreq/devfreq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/devfreq/devfreq.c')
-rw-r--r--drivers/devfreq/devfreq.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index fe2af6aa88fc..0b5b3abe054e 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -628,14 +628,15 @@ struct devfreq *devfreq_add_device(struct device *dev,
goto err_dev;
}
- 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->trans_table =
+ devm_kzalloc(&devfreq->dev,
+ array3_size(sizeof(unsigned int),
+ devfreq->profile->max_state,
+ devfreq->profile->max_state),
+ GFP_KERNEL);
+ devfreq->time_in_state = devm_kcalloc(&devfreq->dev,
devfreq->profile->max_state,
+ sizeof(unsigned long),
GFP_KERNEL);
devfreq->last_stat_updated = jiffies;