Skip to content

Commit bcaf271

Browse files
YuKuai-huaweigregkh
authored andcommitted
ARM: at91: pm: add missing put_device() call in at91_pm_sram_init()
[ Upstream commit f87a4f0 ] 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 <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>
1 parent 12b7ce2 commit bcaf271

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

  • arch/arm/mach-at91

arch/arm/mach-at91/pm.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -542,26 +542,31 @@ static void __init at91_pm_sram_init(void)
542542
sram_pool = gen_pool_get(&pdev->dev, NULL);
543543
if (!sram_pool) {
544544
pr_warn("%s: sram pool unavailable!\n", __func__);
545-
return;
545+
goto out_put_device;
546546
}
547547

548548
sram_base = gen_pool_alloc(sram_pool, at91_pm_suspend_in_sram_sz);
549549
if (!sram_base) {
550550
pr_warn("%s: unable to alloc sram!\n", __func__);
551-
return;
551+
goto out_put_device;
552552
}
553553

554554
sram_pbase = gen_pool_virt_to_phys(sram_pool, sram_base);
555555
at91_suspend_sram_fn = __arm_ioremap_exec(sram_pbase,
556556
at91_pm_suspend_in_sram_sz, false);
557557
if (!at91_suspend_sram_fn) {
558558
pr_warn("SRAM: Could not map\n");
559-
return;
559+
goto out_put_device;
560560
}
561561

562562
/* Copy the pm suspend handler to SRAM */
563563
at91_suspend_sram_fn = fncpy(at91_suspend_sram_fn,
564564
&at91_pm_suspend_in_sram, at91_pm_suspend_in_sram_sz);
565+
return;
566+
567+
out_put_device:
568+
put_device(&pdev->dev);
569+
return;
565570
}
566571

567572
static bool __init at91_is_pm_mode_active(int pm_mode)

0 commit comments

Comments
 (0)