Skip to content

Commit d310124

Browse files
Rahul Tanwarbebarino
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/26624b65d0e6b958c4765a406b9929d1a9ce1c2c.1594880946.git.rahul.tanwar@linux.intel.com [[email protected]: Drop NULL assignment that is overwritten] Signed-off-by: Stephen Boyd <[email protected]>
1 parent c9e28fe commit d310124

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

drivers/clk/x86/clk-cgu.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -581,19 +581,18 @@ int lgm_clk_register_ddiv(struct lgm_clk_provider *ctx,
581581
unsigned int nr_clk)
582582
{
583583
struct device *dev = ctx->dev;
584-
struct clk_init_data init = {};
585-
struct lgm_clk_ddiv *ddiv;
586584
struct clk_hw *hw;
587585
unsigned int idx;
588586
int ret;
589587

590588
for (idx = 0; idx < nr_clk; idx++, list++) {
591-
ddiv = NULL;
589+
struct clk_init_data init = {};
590+
struct lgm_clk_ddiv *ddiv;
591+
592592
ddiv = devm_kzalloc(dev, sizeof(*ddiv), GFP_KERNEL);
593593
if (!ddiv)
594594
return -ENOMEM;
595595

596-
memset(&init, 0, sizeof(init));
597596
init.name = list->name;
598597
init.ops = &lgm_clk_ddiv_ops;
599598
init.flags = list->flags;

0 commit comments

Comments
 (0)