aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArvind Yadav <arvind.yadav.cs@gmail.com>2016-09-20 07:08:58 -0400
committerStephen Boyd <sboyd@codeaurora.org>2016-12-08 19:29:39 -0500
commit81ba3cc29a03b2cd9360739014b7d8ade88a9863 (patch)
treec86d5204f592d0ed75f0137c0f3e456a0ae0b418
parent19b9f29d256f5b088b30109169a711967788fb56 (diff)
clk:mmp:clk-of-mmp2: Free memory and Unmap region obtained by kzalloc and of_iomap
Free memory and memory mapping , if mmp2_clk_init is not successful. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> [sboyd@codeaurora.org: Put return at the right place] Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
-rw-r--r--drivers/clk/mmp/clk-of-mmp2.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/clk/mmp/clk-of-mmp2.c b/drivers/clk/mmp/clk-of-mmp2.c
index 9adaf48aea23..0fc75c395957 100644
--- a/drivers/clk/mmp/clk-of-mmp2.c
+++ b/drivers/clk/mmp/clk-of-mmp2.c
@@ -309,19 +309,19 @@ static void __init mmp2_clk_init(struct device_node *np)
309 pxa_unit->mpmu_base = of_iomap(np, 0); 309 pxa_unit->mpmu_base = of_iomap(np, 0);
310 if (!pxa_unit->mpmu_base) { 310 if (!pxa_unit->mpmu_base) {
311 pr_err("failed to map mpmu registers\n"); 311 pr_err("failed to map mpmu registers\n");
312 return; 312 goto free_memory;
313 } 313 }
314 314
315 pxa_unit->apmu_base = of_iomap(np, 1); 315 pxa_unit->apmu_base = of_iomap(np, 1);
316 if (!pxa_unit->apmu_base) { 316 if (!pxa_unit->apmu_base) {
317 pr_err("failed to map apmu registers\n"); 317 pr_err("failed to map apmu registers\n");
318 return; 318 goto unmap_mpmu_region;
319 } 319 }
320 320
321 pxa_unit->apbc_base = of_iomap(np, 2); 321 pxa_unit->apbc_base = of_iomap(np, 2);
322 if (!pxa_unit->apbc_base) { 322 if (!pxa_unit->apbc_base) {
323 pr_err("failed to map apbc registers\n"); 323 pr_err("failed to map apbc registers\n");
324 return; 324 goto unmap_apmu_region;
325 } 325 }
326 326
327 mmp_clk_init(np, &pxa_unit->unit, MMP2_NR_CLKS); 327 mmp_clk_init(np, &pxa_unit->unit, MMP2_NR_CLKS);
@@ -333,6 +333,15 @@ static void __init mmp2_clk_init(struct device_node *np)
333 mmp2_axi_periph_clk_init(pxa_unit); 333 mmp2_axi_periph_clk_init(pxa_unit);
334 334
335 mmp2_clk_reset_init(np, pxa_unit); 335 mmp2_clk_reset_init(np, pxa_unit);
336
337 return;
338
339unmap_apmu_region:
340 iounmap(pxa_unit->apmu_base);
341unmap_mpmu_region:
342 iounmap(pxa_unit->mpmu_base);
343free_memory:
344 kfree(pxa_unit);
336} 345}
337 346
338CLK_OF_DECLARE(mmp2_clk, "marvell,mmp2-clock", mmp2_clk_init); 347CLK_OF_DECLARE(mmp2_clk, "marvell,mmp2-clock", mmp2_clk_init);