OSDN Git Service

clk: ux500: Improve sizeof() usage
authorMarkus Elfring <elfring@users.sourceforge.net>
Wed, 27 Sep 2017 18:30:53 +0000 (20:30 +0200)
committerStephen Boyd <sboyd@codeaurora.org>
Tue, 14 Nov 2017 01:42:25 +0000 (17:42 -0800)
Replace the specification of 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.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
drivers/clk/ux500/clk-prcc.c
drivers/clk/ux500/clk-prcmu.c
drivers/clk/ux500/clk-sysctrl.c

index 5ca07e6..7cfb59c 100644 (file)
@@ -107,7 +107,7 @@ static struct clk *clk_reg_prcc(const char *name,
                return ERR_PTR(-EINVAL);
        }
 
-       clk = kzalloc(sizeof(struct clk_prcc), GFP_KERNEL);
+       clk = kzalloc(sizeof(*clk), GFP_KERNEL);
        if (!clk)
                return ERR_PTR(-ENOMEM);
 
index c137934..9d1f2d4 100644 (file)
@@ -258,7 +258,7 @@ static struct clk *clk_reg_prcmu(const char *name,
                return ERR_PTR(-EINVAL);
        }
 
-       clk = kzalloc(sizeof(struct clk_prcmu), GFP_KERNEL);
+       clk = kzalloc(sizeof(*clk), GFP_KERNEL);
        if (!clk)
                return ERR_PTR(-ENOMEM);
 
index e0a834c..7c0403b 100644 (file)
@@ -139,7 +139,7 @@ static struct clk *clk_reg_sysctrl(struct device *dev,
                return ERR_PTR(-EINVAL);
        }
 
-       clk = devm_kzalloc(dev, sizeof(struct clk_sysctrl), GFP_KERNEL);
+       clk = devm_kzalloc(dev, sizeof(*clk), GFP_KERNEL);
        if (!clk)
                return ERR_PTR(-ENOMEM);