]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
hwrng: omap3-rom - Call clk_disable_unprepare() on exit only if not idled
authorTony Lindgren <tony@atomide.com>
Sat, 14 Sep 2019 21:02:56 +0000 (14:02 -0700)
committerSeth Forshee <seth.forshee@canonical.com>
Mon, 6 Jan 2020 14:15:00 +0000 (08:15 -0600)
BugLink: https://bugs.launchpad.net/bugs/1858428
[ Upstream commit eaecce12f5f0d2c35d278e41e1bc4522393861ab ]

When unloading omap3-rom-rng, we'll get the following:

WARNING: CPU: 0 PID: 100 at drivers/clk/clk.c:948 clk_core_disable

This is because the clock may be already disabled by omap3_rom_rng_idle().
Let's fix the issue by checking for rng_idle on exit.

Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: Adam Ford <aford173@gmail.com>
Cc: Pali Rohár <pali.rohar@gmail.com>
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Tero Kristo <t-kristo@ti.com>
Fixes: 1c6b7c2108bd ("hwrng: OMAP3 ROM Random Number Generator support")
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/char/hw_random/omap3-rom-rng.c

index 38b719017186ef4f27e3b93a013165f5d9bd8d5d..648e39ce6bd95bcfb34de1624d5240ef343badd9 100644 (file)
@@ -121,7 +121,8 @@ static int omap3_rom_rng_remove(struct platform_device *pdev)
 {
        cancel_delayed_work_sync(&idle_work);
        hwrng_unregister(&omap3_rom_rng_ops);
-       clk_disable_unprepare(rng_clk);
+       if (!rng_idle)
+               clk_disable_unprepare(rng_clk);
        return 0;
 }