platform: tegra: nvavp: fix for pre-decrement of clk_enabled cntr
Bhushan Rupde [Fri, 13 May 2016 09:00:19 +0000 (14:00 +0530)]
Bug 1729847

Change-Id: Ie455b0469a1d4e35453ca9e36c5e90dfdc6f56a2
Signed-off-by: Bhushan Rupde <brupde@nvidia.com>
Reviewed-on: http://git-master/r/1147432
Reviewed-by: Mohan Nimaje <mnimaje@nvidia.com>
Reviewed-by: Soumen Dey <sdey@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

drivers/media/platform/tegra/nvavp/nvavp_dev.c

index 4ca6d30..843ea33 100644 (file)
@@ -567,7 +567,10 @@ static void nvavp_clks_enable(struct nvavp_info *nvavp)
 
 static void nvavp_clks_disable(struct nvavp_info *nvavp)
 {
-       if ((--nvavp->clk_enabled == 0) && !nvavp->stay_on) {
+       if (nvavp->clk_enabled) {
+               nvavp->clk_enabled--;
+       }
+       if ((nvavp->clk_enabled == 0) && !nvavp->stay_on) {
                clk_disable_unprepare(nvavp->bsev_clk);
                clk_disable_unprepare(nvavp->vde_clk);
                clk_set_rate(nvavp->emc_clk, 0);