Skip to content

Commit f87a4f0

Browse files
YuKuai-huaweialexandrebelloni
authored andcommitted
ARM: at91: pm: add missing put_device() call in at91_pm_sram_init()
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: d2e4679 ("ARM: at91: pm: use the mmio-sram pool to access SRAM") Signed-off-by: yu kuai <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent b3a9e3b commit f87a4f0

File tree

1 file changed

+8
-3
lines changed
  • arch/arm/mach-at91

1 file changed

+8
-3
lines changed

arch/arm/mach-at91/pm.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -592,26 +592,31 @@ static void __init at91_pm_sram_init(void)
592592
sram_pool = gen_pool_get(&pdev->dev, NULL);
593593
if (!sram_pool) {
594594
pr_warn("%s: sram pool unavailable!\n", __func__);
595-
return;
595+
goto out_put_device;
596596
}
597597

598598
sram_base = gen_pool_alloc(sram_pool, at91_pm_suspend_in_sram_sz);
599599
if (!sram_base) {
600600
pr_warn("%s: unable to alloc sram!\n", __func__);
601-
return;
601+
goto out_put_device;
602602
}
603603

604604
sram_pbase = gen_pool_virt_to_phys(sram_pool, sram_base);
605605
at91_suspend_sram_fn = __arm_ioremap_exec(sram_pbase,
606606
at91_pm_suspend_in_sram_sz, false);
607607
if (!at91_suspend_sram_fn) {
608608
pr_warn("SRAM: Could not map\n");
609-
return;
609+
goto out_put_device;
610610
}
611611

612612
/* Copy the pm suspend handler to SRAM */
613613
at91_suspend_sram_fn = fncpy(at91_suspend_sram_fn,
614614
&at91_pm_suspend_in_sram, at91_pm_suspend_in_sram_sz);
615+
return;
616+
617+
out_put_device:
618+
put_device(&pdev->dev);
619+
return;
615620
}
616621

617622
static bool __init at91_is_pm_mode_active(int pm_mode)

0 commit comments

Comments
 (0)