]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
ARM: at91: pm: add missing put_device() call in at91_pm_sram_init()
authoryu kuai <yukuai3@huawei.com>
Thu, 4 Jun 2020 12:33:01 +0000 (20:33 +0800)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Fri, 17 Jul 2020 22:58:07 +0000 (00:58 +0200)
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
arch/arm/mach-at91/pm.c

index 074bde64064e424c1ed2806656feeb2cd67555ec..2aab043441e8fb1afd16276e2e1f25e7fecfc2cb 100644 (file)
@@ -592,13 +592,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);
@@ -606,12 +606,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 bool __init at91_is_pm_mode_active(int pm_mode)