aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrzej Hajda <a.hajda@samsung.com>2015-08-07 03:59:16 -0400
committerStephen Boyd <sboyd@codeaurora.org>2015-08-07 18:16:28 -0400
commite8f35aabae837e6d1a1d82a8cc54f8ce7366ed49 (patch)
tree5413e587b4662070431f8b9860369cb83d6720ff
parent1fb6dd9da6ed4f2953b62162f3c498a1f6d7bfca (diff)
clk/mmp: use kmemdup rather than duplicating its implementation
The patch was generated using fixed coccinelle semantic patch scripts/coccinelle/api/memdup.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2014320 Signed-off-by: Andrzej Hajda <a.hajda@samsung.com> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
-rw-r--r--drivers/clk/mmp/clk-mix.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/clk/mmp/clk-mix.c b/drivers/clk/mmp/clk-mix.c
index 665cb6794639..33834105a09f 100644
--- a/drivers/clk/mmp/clk-mix.c
+++ b/drivers/clk/mmp/clk-mix.c
@@ -469,20 +469,20 @@ struct clk *mmp_clk_register_mix(struct device *dev,
469 memcpy(&mix->reg_info, &config->reg_info, sizeof(config->reg_info)); 469 memcpy(&mix->reg_info, &config->reg_info, sizeof(config->reg_info));
470 if (config->table) { 470 if (config->table) {
471 table_bytes = sizeof(*config->table) * config->table_size; 471 table_bytes = sizeof(*config->table) * config->table_size;
472 mix->table = kzalloc(table_bytes, GFP_KERNEL); 472 mix->table = kmemdup(config->table, table_bytes, GFP_KERNEL);
473 if (!mix->table) { 473 if (!mix->table) {
474 pr_err("%s:%s: could not allocate mmp mix table\n", 474 pr_err("%s:%s: could not allocate mmp mix table\n",
475 __func__, name); 475 __func__, name);
476 kfree(mix); 476 kfree(mix);
477 return ERR_PTR(-ENOMEM); 477 return ERR_PTR(-ENOMEM);
478 } 478 }
479 memcpy(mix->table, config->table, table_bytes);
480 mix->table_size = config->table_size; 479 mix->table_size = config->table_size;
481 } 480 }
482 481
483 if (config->mux_table) { 482 if (config->mux_table) {
484 table_bytes = sizeof(u32) * num_parents; 483 table_bytes = sizeof(u32) * num_parents;
485 mix->mux_table = kzalloc(table_bytes, GFP_KERNEL); 484 mix->mux_table = kmemdup(config->mux_table, table_bytes,
485 GFP_KERNEL);
486 if (!mix->mux_table) { 486 if (!mix->mux_table) {
487 pr_err("%s:%s: could not allocate mmp mix mux-table\n", 487 pr_err("%s:%s: could not allocate mmp mix mux-table\n",
488 __func__, name); 488 __func__, name);
@@ -490,7 +490,6 @@ struct clk *mmp_clk_register_mix(struct device *dev,
490 kfree(mix); 490 kfree(mix);
491 return ERR_PTR(-ENOMEM); 491 return ERR_PTR(-ENOMEM);
492 } 492 }
493 memcpy(mix->mux_table, config->mux_table, table_bytes);
494 } 493 }
495 494
496 mix->div_flags = config->div_flags; 495 mix->div_flags = config->div_flags;