]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
clk: mvebu: Use kcalloc() in of_cpu_clk_setup()
authorMarkus Elfring <elfring@users.sourceforge.net>
Wed, 19 Apr 2017 18:15:21 +0000 (20:15 +0200)
committerStephen Boyd <sboyd@codeaurora.org>
Sat, 22 Apr 2017 02:49:13 +0000 (19:49 -0700)
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
drivers/clk/mvebu/clk-cpu.c

index 044892b6534d93ed3427ea405f78117349136cf7..072aa38374ce9a2db26103b4ed83cfa8bcb70434 100644 (file)
@@ -186,11 +186,11 @@ static void __init of_cpu_clk_setup(struct device_node *node)
        for_each_node_by_type(dn, "cpu")
                ncpus++;
 
-       cpuclk = kzalloc(ncpus * sizeof(*cpuclk), GFP_KERNEL);
+       cpuclk = kcalloc(ncpus, sizeof(*cpuclk), GFP_KERNEL);
        if (WARN_ON(!cpuclk))
                goto cpuclk_out;
 
-       clks = kzalloc(ncpus * sizeof(*clks), GFP_KERNEL);
+       clks = kcalloc(ncpus, sizeof(*clks), GFP_KERNEL);
        if (WARN_ON(!clks))
                goto clks_out;