diff options
author | Rahul Tanwar <rahul.tanwar@linux.intel.com> | 2020-07-16 14:30:32 +0800 |
---|---|---|
committer | Stephen Boyd <sboyd@kernel.org> | 2020-07-24 01:58:15 -0700 |
commit | d310124cd99df5e5011d79f36a6d16d3452de348 (patch) | |
tree | 139e3448d113699f4bc9ead0b7ce4871f700c32c /drivers/clk/x86 | |
parent | c9e28fe649f76ee13a9bcc09f89ae0189f85801b (diff) | |
download | linux-d310124cd99df5e5011d79f36a6d16d3452de348.tar.bz2 |
clk: intel: Avoid unnecessary memset by improving code
memset can be avoided in a loop if the variables used are declared
inside the loop. Move such variables declaration inside the loop
to avoid memset.
Signed-off-by: Rahul Tanwar <rahul.tanwar@linux.intel.com>
Link: https://lore.kernel.org/r/26624b65d0e6b958c4765a406b9929d1a9ce1c2c.1594880946.git.rahul.tanwar@linux.intel.com
[sboyd@kernel.org: Drop NULL assignment that is overwritten]
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'drivers/clk/x86')
-rw-r--r-- | drivers/clk/x86/clk-cgu.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/clk/x86/clk-cgu.c b/drivers/clk/x86/clk-cgu.c index c379fedfb9f2..33de600e0c38 100644 --- a/drivers/clk/x86/clk-cgu.c +++ b/drivers/clk/x86/clk-cgu.c @@ -581,19 +581,18 @@ int lgm_clk_register_ddiv(struct lgm_clk_provider *ctx, unsigned int nr_clk) { struct device *dev = ctx->dev; - struct clk_init_data init = {}; - struct lgm_clk_ddiv *ddiv; struct clk_hw *hw; unsigned int idx; int ret; for (idx = 0; idx < nr_clk; idx++, list++) { - ddiv = NULL; + struct clk_init_data init = {}; + struct lgm_clk_ddiv *ddiv; + ddiv = devm_kzalloc(dev, sizeof(*ddiv), GFP_KERNEL); if (!ddiv) return -ENOMEM; - memset(&init, 0, sizeof(init)); init.name = list->name; init.ops = &lgm_clk_ddiv_ops; init.flags = list->flags; |