Commit e9baa279 authored by Markus Elfring's avatar Markus Elfring Committed by Stephen Boyd

clk: mmp: Use common error handling code in mmp_clk_register_mix()

Add a jump target so that a bit of exception handling can be
better reused at the end of this function.
Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
parent 1cc36f73
...@@ -464,10 +464,9 @@ struct clk *mmp_clk_register_mix(struct device *dev, ...@@ -464,10 +464,9 @@ struct clk *mmp_clk_register_mix(struct device *dev,
if (config->table) { if (config->table) {
table_bytes = sizeof(*config->table) * config->table_size; table_bytes = sizeof(*config->table) * config->table_size;
mix->table = kmemdup(config->table, table_bytes, GFP_KERNEL); mix->table = kmemdup(config->table, table_bytes, GFP_KERNEL);
if (!mix->table) { if (!mix->table)
kfree(mix); goto free_mix;
return ERR_PTR(-ENOMEM);
}
mix->table_size = config->table_size; mix->table_size = config->table_size;
} }
...@@ -477,8 +476,7 @@ struct clk *mmp_clk_register_mix(struct device *dev, ...@@ -477,8 +476,7 @@ struct clk *mmp_clk_register_mix(struct device *dev,
GFP_KERNEL); GFP_KERNEL);
if (!mix->mux_table) { if (!mix->mux_table) {
kfree(mix->table); kfree(mix->table);
kfree(mix); goto free_mix;
return ERR_PTR(-ENOMEM);
} }
} }
...@@ -502,4 +500,8 @@ struct clk *mmp_clk_register_mix(struct device *dev, ...@@ -502,4 +500,8 @@ struct clk *mmp_clk_register_mix(struct device *dev,
} }
return clk; return clk;
free_mix:
kfree(mix);
return ERR_PTR(-ENOMEM);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment