From: Tony Lindgren Date: Sat, 14 Sep 2019 21:02:56 +0000 (-0700) Subject: hwrng: omap3-rom - Call clk_disable_unprepare() on exit only if not idled X-Git-Tag: Ubuntu-5.4-5.4.0-11.14~584 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=ab89a2297fca034855f6d4baaff2e3ed2cf7d042;p=mirror_ubuntu-focal-kernel.git hwrng: omap3-rom - Call clk_disable_unprepare() on exit only if not idled 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 Cc: Adam Ford Cc: Pali Rohár Cc: Sebastian Reichel Cc: Tero Kristo Fixes: 1c6b7c2108bd ("hwrng: OMAP3 ROM Random Number Generator support") Signed-off-by: Tony Lindgren Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Signed-off-by: Seth Forshee --- diff --git a/drivers/char/hw_random/omap3-rom-rng.c b/drivers/char/hw_random/omap3-rom-rng.c index 38b719017186..648e39ce6bd9 100644 --- a/drivers/char/hw_random/omap3-rom-rng.c +++ b/drivers/char/hw_random/omap3-rom-rng.c @@ -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; }