mmc: core: Fix crash in mmc clk-scaling

kernel crashes with below signature on trying to
acquire uninitialized clk-scaling spinlock.
Fix it by checking that clk scaling is
initialized before acquiring this lock.

BUG: spinlock bad magic on CPU#0, kworker/0:1/39
Backtrace:
 __delay+0x1c
 __const_udelay+0x24
 msm_trigger_wdog_bite+0xbc
 spin_bug+0x8c
 do_raw_spin_lock+0x34
 _raw_spin_lock_irqsave+0x28
 mmc_reset_clk_scale_stats+0x40
 mmc_host_clk_hold+0x5c
 mmc_start_request+0x1ec
 mmc_wait_for_req+0x98
 mmc_wait_for_cmd+0x70
 __mmc_switch+0xd0
 mmc_switch+0x18
 mmc_flush_cache+0x4c
 _mmc_suspend.isra.8+0x6c
 mmc_runtime_suspend+0x38
 mmc_runtime_suspend+0x18
 __rpm_callback+0x40
 rpm_callback+0x44
 rpm_suspend+0x2a4
 pm_runtime_work+0x78
 process_one_work+0x264
 worker_thread+0x1f8
 kthread+0xdc
 ret_from_fork+0x10

Change-Id: I8347e2d5ad1816f549ef8ab2607546203aa4a21d
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
This commit is contained in:
Ritesh Harjani 2015-05-29 11:26:34 +05:30 committed by Subhash Jadavani
parent a968943d35
commit 5e2fbf9a0d

View file

@ -666,7 +666,8 @@ void mmc_reset_clk_scale_stats(struct mmc_host *host)
WARN_ON(1);
return;
}
if (!host->clk_scaling.enable)
return;
spin_lock_irqsave(&host->clk_scaling.lock, flags);
host->clk_scaling.total_busy_time_us = 0;
spin_unlock_irqrestore(&host->clk_scaling.lock, flags);