diff options
author | Tomasz Figa <tomasz.figa@gmail.com> | 2013-09-28 20:37:15 -0400 |
---|---|---|
committer | Mike Turquette <mturquette@linaro.org> | 2013-10-01 21:40:16 -0400 |
commit | 96a7ed9079a3483c5681b17f4713c37c1cf2b1c9 (patch) | |
tree | 774e563607a79fc5214f628698eb607d8a11c37d | |
parent | f1c8b2edf916b5be9dc29e98989a5eaff3c6e75b (diff) |
clk: Use kcalloc() to allocate arrays
Instead of calculating sizes of arrays manually, kcalloc() can be used
to allocate arrays of elements with defined size. This is just a cleanup
patch without any functional changes.
Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
-rw-r--r-- | drivers/clk/clk.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 9e0a8372f59c..63f9ac16dcb6 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c | |||
@@ -1085,8 +1085,8 @@ static int clk_fetch_parent_index(struct clk *clk, struct clk *parent) | |||
1085 | int i; | 1085 | int i; |
1086 | 1086 | ||
1087 | if (!clk->parents) { | 1087 | if (!clk->parents) { |
1088 | clk->parents = kzalloc((sizeof(struct clk*) * clk->num_parents), | 1088 | clk->parents = kcalloc(clk->num_parents, |
1089 | GFP_KERNEL); | 1089 | sizeof(struct clk *), GFP_KERNEL); |
1090 | if (!clk->parents) | 1090 | if (!clk->parents) |
1091 | return -ENOMEM; | 1091 | return -ENOMEM; |
1092 | } | 1092 | } |
@@ -1535,7 +1535,7 @@ static struct clk *__clk_init_parent(struct clk *clk) | |||
1535 | 1535 | ||
1536 | if (!clk->parents) | 1536 | if (!clk->parents) |
1537 | clk->parents = | 1537 | clk->parents = |
1538 | kzalloc((sizeof(struct clk*) * clk->num_parents), | 1538 | kcalloc(clk->num_parents, sizeof(struct clk *), |
1539 | GFP_KERNEL); | 1539 | GFP_KERNEL); |
1540 | 1540 | ||
1541 | ret = clk_get_parent_by_index(clk, index); | 1541 | ret = clk_get_parent_by_index(clk, index); |
@@ -1692,8 +1692,8 @@ int __clk_init(struct device *dev, struct clk *clk) | |||
1692 | * for clock drivers to statically initialize clk->parents. | 1692 | * for clock drivers to statically initialize clk->parents. |
1693 | */ | 1693 | */ |
1694 | if (clk->num_parents > 1 && !clk->parents) { | 1694 | if (clk->num_parents > 1 && !clk->parents) { |
1695 | clk->parents = kzalloc((sizeof(struct clk*) * clk->num_parents), | 1695 | clk->parents = kcalloc(clk->num_parents, sizeof(struct clk *), |
1696 | GFP_KERNEL); | 1696 | GFP_KERNEL); |
1697 | /* | 1697 | /* |
1698 | * __clk_lookup returns NULL for parents that have not been | 1698 | * __clk_lookup returns NULL for parents that have not been |
1699 | * clk_init'd; thus any access to clk->parents[] must check | 1699 | * clk_init'd; thus any access to clk->parents[] must check |
@@ -1833,8 +1833,8 @@ static int _clk_register(struct device *dev, struct clk_hw *hw, struct clk *clk) | |||
1833 | hw->clk = clk; | 1833 | hw->clk = clk; |
1834 | 1834 | ||
1835 | /* allocate local copy in case parent_names is __initdata */ | 1835 | /* allocate local copy in case parent_names is __initdata */ |
1836 | clk->parent_names = kzalloc((sizeof(char*) * clk->num_parents), | 1836 | clk->parent_names = kcalloc(clk->num_parents, sizeof(char *), |
1837 | GFP_KERNEL); | 1837 | GFP_KERNEL); |
1838 | 1838 | ||
1839 | if (!clk->parent_names) { | 1839 | if (!clk->parent_names) { |
1840 | pr_err("%s: could not allocate clk->parent_names\n", __func__); | 1840 | pr_err("%s: could not allocate clk->parent_names\n", __func__); |