summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryu kuai <yukuai3@huawei.com>2020-06-04 20:33:01 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-08-21 11:01:57 +0200
commitb345f860b020a65df4372f377fd5bd88274c2853 (patch)
tree833fa4a6b5f9f45464dd0a0d0b0c1b41342194b7
parent7ee70737bcb0617a819aed495616ec0b2a2dc37a (diff)
downloadlinux-stable-b345f860b020a65df4372f377fd5bd88274c2853.tar.gz
linux-stable-b345f860b020a65df4372f377fd5bd88274c2853.tar.bz2
linux-stable-b345f860b020a65df4372f377fd5bd88274c2853.zip
ARM: at91: pm: add missing put_device() call in at91_pm_sram_init()
[ Upstream commit f87a4f022c44e5b87e842a9f3e644fba87e8385f ] 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: d2e467905596 ("ARM: at91: pm: use the mmio-sram pool to access SRAM") Signed-off-by: yu kuai <yukuai3@huawei.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200604123301.3905837-1-yukuai3@huawei.com Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--arch/arm/mach-at91/pm.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index 8ba0e2e5ad97..0efac1404418 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -411,13 +411,13 @@ static void __init at91_pm_sram_init(void)
sram_pool = gen_pool_get(&pdev->dev, NULL);
if (!sram_pool) {
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);
if (!sram_base) {
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);
@@ -425,12 +425,17 @@ static void __init at91_pm_sram_init(void)
at91_pm_suspend_in_sram_sz, false);
if (!at91_suspend_sram_fn) {
pr_warn("SRAM: Could not map\n");
- return;
+ goto out_put_device;
}
/* Copy the pm suspend handler to SRAM */
at91_suspend_sram_fn = fncpy(at91_suspend_sram_fn,
&at91_pm_suspend_in_sram, at91_pm_suspend_in_sram_sz);
+ return;
+
+out_put_device:
+ put_device(&pdev->dev);
+ return;
}
static const struct of_device_id atmel_pmc_ids[] __initconst = {