Commit ed3630d5 authored by yu kuai's avatar yu kuai Committed by Kelsey Skunberg

ARM: at91: pm: add missing put_device() call in at91_pm_sram_init()

BugLink: https://bugs.launchpad.net/bugs/1892822

[ Upstream commit f87a4f02 ]

if of_find_device_by_node() succeed, at91_pm_sram_init() doesn't have
a corresponding put_device(). Thus add a jump target to fix the exception
handling for this function implementation.

Fixes: d2e46790 ("ARM: at91: pm: use the mmio-sram pool to access SRAM")
Signed-off-by: default avataryu kuai <yukuai3@huawei.com>
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20200604123301.3905837-1-yukuai3@huawei.comSigned-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: default avatarIan May <ian.may@canonical.com>
Signed-off-by: default avatarKelsey Skunberg <kelsey.skunberg@canonical.com>
parent aead951d
...@@ -393,13 +393,13 @@ static void __init at91_pm_sram_init(void) ...@@ -393,13 +393,13 @@ static void __init at91_pm_sram_init(void)
sram_pool = gen_pool_get(&pdev->dev, NULL); sram_pool = gen_pool_get(&pdev->dev, NULL);
if (!sram_pool) { if (!sram_pool) {
pr_warn("%s: sram pool unavailable!\n", __func__); pr_warn("%s: sram pool unavailable!\n", __func__);
return; goto out_put_device;
} }
sram_base = gen_pool_alloc(sram_pool, at91_pm_suspend_in_sram_sz); sram_base = gen_pool_alloc(sram_pool, at91_pm_suspend_in_sram_sz);
if (!sram_base) { if (!sram_base) {
pr_warn("%s: unable to alloc sram!\n", __func__); pr_warn("%s: unable to alloc sram!\n", __func__);
return; goto out_put_device;
} }
sram_pbase = gen_pool_virt_to_phys(sram_pool, sram_base); sram_pbase = gen_pool_virt_to_phys(sram_pool, sram_base);
...@@ -407,12 +407,17 @@ static void __init at91_pm_sram_init(void) ...@@ -407,12 +407,17 @@ static void __init at91_pm_sram_init(void)
at91_pm_suspend_in_sram_sz, false); at91_pm_suspend_in_sram_sz, false);
if (!at91_suspend_sram_fn) { if (!at91_suspend_sram_fn) {
pr_warn("SRAM: Could not map\n"); pr_warn("SRAM: Could not map\n");
return; goto out_put_device;
} }
/* Copy the pm suspend handler to SRAM */ /* Copy the pm suspend handler to SRAM */
at91_suspend_sram_fn = fncpy(at91_suspend_sram_fn, at91_suspend_sram_fn = fncpy(at91_suspend_sram_fn,
&at91_pm_suspend_in_sram, at91_pm_suspend_in_sram_sz); &at91_pm_suspend_in_sram, at91_pm_suspend_in_sram_sz);
return;
out_put_device:
put_device(&pdev->dev);
return;
} }
static void __init at91_pm_init(void) static void __init at91_pm_init(void)
......
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