]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
clk: bcm/kona: Do not use sizeof on pointer type
authorVaishali Thakkar <vaishali.thakkar@oracle.com>
Thu, 28 Apr 2016 13:50:33 +0000 (19:20 +0530)
committerStephen Boyd <sboyd@codeaurora.org>
Fri, 6 May 2016 18:06:44 +0000 (11:06 -0700)
When sizeof is applied to a pointer typed expression, it gives
the size of the pointer. So, here do not use sizeof on pointer
type. Also, silent checkpatch.pl by using kmalloc_array over
kmalloc.

Note that this has no effect on runtime because 'parent_names'
is a pointer to a pointer.

Problem found using Coccinelle.

Signed-off-by: Vaishali Thakkar <vaishali.thakkar@oracle.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
drivers/clk/bcm/clk-kona-setup.c

index deaa7f962b84ac814eb2445d698d343d45018aec..526b0b0e9a9f9f4f79fea3812177487dfe586c11 100644 (file)
@@ -577,7 +577,8 @@ static u32 *parent_process(const char *clocks[],
         * selector is not required, but we allocate space for the
         * array anyway to keep things simple.
         */
-       parent_names = kmalloc(parent_count * sizeof(parent_names), GFP_KERNEL);
+       parent_names = kmalloc_array(parent_count, sizeof(*parent_names),
+                              GFP_KERNEL);
        if (!parent_names) {
                pr_err("%s: error allocating %u parent names\n", __func__,
                                parent_count);