Skip to content

Commit

Permalink
clk: ux500: Improve sizeof() usage
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Ulf Hansson <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
  • Loading branch information
elfring authored and bebarino committed Nov 14, 2017
1 parent 7a294dc commit 0b10adb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion drivers/clk/ux500/clk-prcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion drivers/clk/ux500/clk-prcmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion drivers/clk/ux500/clk-sysctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 0b10adb

Please sign in to comment.