aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArvind Yadav <arvind.yadav.cs@gmail.com>2016-09-20 06:59:38 -0400
committerStephen Boyd <sboyd@codeaurora.org>2016-12-08 19:29:38 -0500
commit19b9f29d256f5b088b30109169a711967788fb56 (patch)
treeaf191de44ed863ac802e4b1b8fbae250670bfad1
parent8daa528204de0d8f085013a3ea1d8af755636885 (diff)
clk:mmp:clk-of-pxa910: Free memory and Unmap region obtained by kzmalloc and of_iomap
Free memory and memory mapping , if pxa910_clk_init is not successful. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
-rw-r--r--drivers/clk/mmp/clk-of-pxa910.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/clk/mmp/clk-of-pxa910.c b/drivers/clk/mmp/clk-of-pxa910.c
index 64d1ef49caeb..1dcabe95cb67 100644
--- a/drivers/clk/mmp/clk-of-pxa910.c
+++ b/drivers/clk/mmp/clk-of-pxa910.c
@@ -278,25 +278,25 @@ static void __init pxa910_clk_init(struct device_node *np)
278 pxa_unit->mpmu_base = of_iomap(np, 0); 278 pxa_unit->mpmu_base = of_iomap(np, 0);
279 if (!pxa_unit->mpmu_base) { 279 if (!pxa_unit->mpmu_base) {
280 pr_err("failed to map mpmu registers\n"); 280 pr_err("failed to map mpmu registers\n");
281 return; 281 goto free_memory;
282 } 282 }
283 283
284 pxa_unit->apmu_base = of_iomap(np, 1); 284 pxa_unit->apmu_base = of_iomap(np, 1);
285 if (!pxa_unit->apmu_base) { 285 if (!pxa_unit->apmu_base) {
286 pr_err("failed to map apmu registers\n"); 286 pr_err("failed to map apmu registers\n");
287 return; 287 goto unmap_mpmu_region;
288 } 288 }
289 289
290 pxa_unit->apbc_base = of_iomap(np, 2); 290 pxa_unit->apbc_base = of_iomap(np, 2);
291 if (!pxa_unit->apbc_base) { 291 if (!pxa_unit->apbc_base) {
292 pr_err("failed to map apbc registers\n"); 292 pr_err("failed to map apbc registers\n");
293 return; 293 goto unmap_apmu_region;
294 } 294 }
295 295
296 pxa_unit->apbcp_base = of_iomap(np, 3); 296 pxa_unit->apbcp_base = of_iomap(np, 3);
297 if (!pxa_unit->apbcp_base) { 297 if (!pxa_unit->apbcp_base) {
298 pr_err("failed to map apbcp registers\n"); 298 pr_err("failed to map apbcp registers\n");
299 return; 299 goto unmap_apbc_region;
300 } 300 }
301 301
302 mmp_clk_init(np, &pxa_unit->unit, PXA910_NR_CLKS); 302 mmp_clk_init(np, &pxa_unit->unit, PXA910_NR_CLKS);
@@ -308,6 +308,17 @@ static void __init pxa910_clk_init(struct device_node *np)
308 pxa910_axi_periph_clk_init(pxa_unit); 308 pxa910_axi_periph_clk_init(pxa_unit);
309 309
310 pxa910_clk_reset_init(np, pxa_unit); 310 pxa910_clk_reset_init(np, pxa_unit);
311
312 return;
313
314unmap_apbc_region:
315 iounmap(pxa_unit->apbc_base);
316unmap_apmu_region:
317 iounmap(pxa_unit->apmu_base);
318unmap_mpmu_region:
319 iounmap(pxa_unit->mpmu_base);
320free_memory:
321 kfree(pxa_unit);
311} 322}
312 323
313CLK_OF_DECLARE(pxa910_clk, "marvell,pxa910-clock", pxa910_clk_init); 324CLK_OF_DECLARE(pxa910_clk, "marvell,pxa910-clock", pxa910_clk_init);