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.koski...@iki.fi>
Cc: Adam Ford <aford...@gmail.com>
Cc: Pali Rohár <pali.ro...@gmail.com>
Cc: Sebastian Reichel <s...@kernel.org>
Cc: Tero Kristo <t-kri...@ti.com>
Fixes: 1c6b7c2108bd ("hwrng: OMAP3 ROM Random Number Generator support")
Signed-off-by: Tony Lindgren <t...@atomide.com>
---
 drivers/char/hw_random/omap3-rom-rng.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/char/hw_random/omap3-rom-rng.c 
b/drivers/char/hw_random/omap3-rom-rng.c
--- a/drivers/char/hw_random/omap3-rom-rng.c
+++ b/drivers/char/hw_random/omap3-rom-rng.c
@@ -127,7 +127,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;
 }
 
-- 
2.23.0

Reply via email to