Commit e8f35aab authored by Andrzej Hajda's avatar Andrzej Hajda Committed by Stephen Boyd

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]: default avatarAndrzej Hajda <>
Signed-off-by: default avatarStephen Boyd <>
parent 1fb6dd9d
......@@ -469,20 +469,20 @@ struct clk *mmp_clk_register_mix(struct device *dev,
memcpy(&mix->reg_info, &config->reg_info, sizeof(config->reg_info));
if (config->table) {
table_bytes = sizeof(*config->table) * config->table_size;
mix->table = kzalloc(table_bytes, GFP_KERNEL);
mix->table = kmemdup(config->table, table_bytes, GFP_KERNEL);
if (!mix->table) {
pr_err("%s:%s: could not allocate mmp mix table\n",
__func__, name);
return ERR_PTR(-ENOMEM);
memcpy(mix->table, config->table, table_bytes);
mix->table_size = config->table_size;
if (config->mux_table) {
table_bytes = sizeof(u32) * num_parents;
mix->mux_table = kzalloc(table_bytes, GFP_KERNEL);
mix->mux_table = kmemdup(config->mux_table, table_bytes,
if (!mix->mux_table) {
pr_err("%s:%s: could not allocate mmp mix mux-table\n",
__func__, name);
......@@ -490,7 +490,6 @@ struct clk *mmp_clk_register_mix(struct device *dev,
return ERR_PTR(-ENOMEM);
memcpy(mix->mux_table, config->mux_table, table_bytes);
mix->div_flags = config->div_flags;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment