clk: Improve a size determination in two functions
authorMarkus Elfring <elfring@users.sourceforge.net>
Thu, 20 Apr 2017 07:30:52 +0000 (09:30 +0200)
committerStephen Boyd <sboyd@codeaurora.org>
Sat, 22 Apr 2017 02:47:02 +0000 (19:47 -0700)
Replace the specification of two data structures by pointer dereferences
as the parameter for the operator "sizeof" 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>
drivers/clk/clk.c

index 3e5562a..fc58c52 100644 (file)
@@ -2973,7 +2973,7 @@ int clk_notifier_register(struct clk *clk, struct notifier_block *nb)
 
        /* if clk wasn't in the notifier list, allocate new clk_notifier */
        if (cn->clk != clk) {
-               cn = kzalloc(sizeof(struct clk_notifier), GFP_KERNEL);
+               cn = kzalloc(sizeof(*cn), GFP_KERNEL);
                if (!cn)
                        goto out;
 
@@ -3121,7 +3121,7 @@ int of_clk_add_provider(struct device_node *np,
        struct of_clk_provider *cp;
        int ret;
 
-       cp = kzalloc(sizeof(struct of_clk_provider), GFP_KERNEL);
+       cp = kzalloc(sizeof(*cp), GFP_KERNEL);
        if (!cp)
                return -ENOMEM;