Commit 481ecbd9 authored by Yu Kuai's avatar Yu Kuai Committed by Kelsey Skunberg

ARM: socfpga: PM: add missing put_device() call in socfpga_setup_ocram_self_refresh()

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

[ Upstream commit 3ad7b4e8 ]

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

Fixes: 44fd8c7d ("ARM: socfpga: support suspend to ram")
Signed-off-by: default avatarYu Kuai <yukuai3@huawei.com>
Signed-off-by: default avatarDinh Nguyen <dinguyen@kernel.org>
Signed-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 ed3630d5
...@@ -60,14 +60,14 @@ static int socfpga_setup_ocram_self_refresh(void) ...@@ -60,14 +60,14 @@ static int socfpga_setup_ocram_self_refresh(void)
if (!ocram_pool) { if (!ocram_pool) {
pr_warn("%s: ocram pool unavailable!\n", __func__); pr_warn("%s: ocram pool unavailable!\n", __func__);
ret = -ENODEV; ret = -ENODEV;
goto put_node; goto put_device;
} }
ocram_base = gen_pool_alloc(ocram_pool, socfpga_sdram_self_refresh_sz); ocram_base = gen_pool_alloc(ocram_pool, socfpga_sdram_self_refresh_sz);
if (!ocram_base) { if (!ocram_base) {
pr_warn("%s: unable to alloc ocram!\n", __func__); pr_warn("%s: unable to alloc ocram!\n", __func__);
ret = -ENOMEM; ret = -ENOMEM;
goto put_node; goto put_device;
} }
ocram_pbase = gen_pool_virt_to_phys(ocram_pool, ocram_base); ocram_pbase = gen_pool_virt_to_phys(ocram_pool, ocram_base);
...@@ -78,7 +78,7 @@ static int socfpga_setup_ocram_self_refresh(void) ...@@ -78,7 +78,7 @@ static int socfpga_setup_ocram_self_refresh(void)
if (!suspend_ocram_base) { if (!suspend_ocram_base) {
pr_warn("%s: __arm_ioremap_exec failed!\n", __func__); pr_warn("%s: __arm_ioremap_exec failed!\n", __func__);
ret = -ENOMEM; ret = -ENOMEM;
goto put_node; goto put_device;
} }
/* Copy the code that puts DDR in self refresh to ocram */ /* Copy the code that puts DDR in self refresh to ocram */
...@@ -92,6 +92,8 @@ static int socfpga_setup_ocram_self_refresh(void) ...@@ -92,6 +92,8 @@ static int socfpga_setup_ocram_self_refresh(void)
if (!socfpga_sdram_self_refresh_in_ocram) if (!socfpga_sdram_self_refresh_in_ocram)
ret = -EFAULT; ret = -EFAULT;
put_device:
put_device(&pdev->dev);
put_node: put_node:
of_node_put(np); of_node_put(np);
......
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