Skip to content

Commit

Permalink
ARM: davinci: PM: Free resources in error handling path in 'davinci_p…
Browse files Browse the repository at this point in the history
…m_init'

If 'sram_alloc' fails, we need to free already allocated resources.

Fixes: aa9aa1e ("ARM: davinci: PM: rework init, remove platform device")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
  • Loading branch information
Christophe JAILLET authored and Sekhar Nori committed May 17, 2017
1 parent 2ea659a commit f3f6cc8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion arch/arm/mach-davinci/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,17 @@ int __init davinci_pm_init(void)
davinci_sram_suspend = sram_alloc(davinci_cpu_suspend_sz, NULL);
if (!davinci_sram_suspend) {
pr_err("PM: cannot allocate SRAM memory\n");
return -ENOMEM;
ret = -ENOMEM;
goto no_sram_mem;
}

davinci_sram_push(davinci_sram_suspend, davinci_cpu_suspend,
davinci_cpu_suspend_sz);

suspend_set_ops(&davinci_pm_ops);

no_sram_mem:
iounmap(pm_config.ddrpsc_reg_base);
no_ddrpsc_mem:
iounmap(pm_config.ddrpll_reg_base);
no_ddrpll_mem:
Expand Down

0 comments on commit f3f6cc8

Please sign in to comment.