diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2017-09-26 23:33:18 +0300 |
---|---|---|
committer | Stephen Boyd <sboyd@codeaurora.org> | 2017-11-14 04:40:33 +0300 |
commit | e9baa279949fff9f78f3ad0e1606f7b148746765 (patch) | |
tree | 889064fc9bae579c3f3593d08d9451751cb5fa37 | |
parent | 1cc36f73005427c7a74b0fdf0177cd0bf981e9ff (diff) | |
download | linux-e9baa279949fff9f78f3ad0e1606f7b148746765.tar.xz |
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: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
-rw-r--r-- | drivers/clk/mmp/clk-mix.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/clk/mmp/clk-mix.c b/drivers/clk/mmp/clk-mix.c index 1ae532df20f7..b2471fb369f1 100644 --- a/drivers/clk/mmp/clk-mix.c +++ b/drivers/clk/mmp/clk-mix.c @@ -464,10 +464,9 @@ struct clk *mmp_clk_register_mix(struct device *dev, if (config->table) { table_bytes = sizeof(*config->table) * config->table_size; mix->table = kmemdup(config->table, table_bytes, GFP_KERNEL); - if (!mix->table) { - kfree(mix); - return ERR_PTR(-ENOMEM); - } + if (!mix->table) + goto free_mix; + mix->table_size = config->table_size; } @@ -477,8 +476,7 @@ struct clk *mmp_clk_register_mix(struct device *dev, GFP_KERNEL); if (!mix->mux_table) { kfree(mix->table); - kfree(mix); - return ERR_PTR(-ENOMEM); + goto free_mix; } } @@ -502,4 +500,8 @@ struct clk *mmp_clk_register_mix(struct device *dev, } return clk; + +free_mix: + kfree(mix); + return ERR_PTR(-ENOMEM); } |