aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2017-04-19 15:08:54 -0400
committerStephen Boyd <sboyd@codeaurora.org>2017-04-21 22:49:34 -0400
commitee7d74339df71015ae5b98d91393ea80b72a4546 (patch)
treeef5b97cfbe4565b5a122a2c424b9ed9b28fab6cd
parent23826e240ad82727635eb84fff1211dd2ff750fb (diff)
clk: mvebu: Use kcalloc() in two functions
* Multiplications for the size determination of memory allocations indicated that array data structures should be processed. Thus use the corresponding function "kcalloc". This issue was detected by using the Coccinelle software. * Replace the specification of data types by pointer dereferences to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
-rw-r--r--drivers/clk/mvebu/common.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/clk/mvebu/common.c b/drivers/clk/mvebu/common.c
index 66be2e0c82b4..472c88b90256 100644
--- a/drivers/clk/mvebu/common.c
+++ b/drivers/clk/mvebu/common.c
@@ -126,7 +126,7 @@ void __init mvebu_coreclk_setup(struct device_node *np,
126 if (desc->get_refclk_freq) 126 if (desc->get_refclk_freq)
127 clk_data.clk_num += 1; 127 clk_data.clk_num += 1;
128 128
129 clk_data.clks = kzalloc(clk_data.clk_num * sizeof(struct clk *), 129 clk_data.clks = kcalloc(clk_data.clk_num, sizeof(*clk_data.clks),
130 GFP_KERNEL); 130 GFP_KERNEL);
131 if (WARN_ON(!clk_data.clks)) { 131 if (WARN_ON(!clk_data.clks)) {
132 iounmap(base); 132 iounmap(base);
@@ -270,7 +270,7 @@ void __init mvebu_clk_gating_setup(struct device_node *np,
270 n++; 270 n++;
271 271
272 ctrl->num_gates = n; 272 ctrl->num_gates = n;
273 ctrl->gates = kzalloc(ctrl->num_gates * sizeof(struct clk *), 273 ctrl->gates = kcalloc(ctrl->num_gates, sizeof(*ctrl->gates),
274 GFP_KERNEL); 274 GFP_KERNEL);
275 if (WARN_ON(!ctrl->gates)) 275 if (WARN_ON(!ctrl->gates))
276 goto gates_out; 276 goto gates_out;