]> git.baikalelectronics.ru Git - 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)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 4 Oct 2019 15:06:11 +0000 (01:06 +1000)
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: d069ab492c66 ("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>
drivers/char/hw_random/omap3-rom-rng.c

index 34e10f05545a4f297c750ed603ad5df7ad57040b..8df3cad7c97aeb7e622f39263ad8bde85eb9d679 100644 (file)
@@ -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;
 }