msm: clock-local: Add md_reg check for rcg_clock handoff
md_reg may be not present for some clocks with banks e.g. rot_clk
so need to add this check for these clocks. Otherwise, there might
be pointer dereference issue.
Change-Id: I3ad44232fa785d2cbca9ef81ac85843103ada3c6
Signed-off-by: Tianyi Gou <tgou@codeaurora.org>
diff --git a/arch/arm/mach-msm/clock-local.c b/arch/arm/mach-msm/clock-local.c
index 2d5ae78..1bb9c86 100644
--- a/arch/arm/mach-msm/clock-local.c
+++ b/arch/arm/mach-msm/clock-local.c
@@ -631,7 +631,8 @@
bank_info = &bank_masks->bank1_mask;
ns_mask = bank_info->ns_mask;
- md_val = readl_relaxed(bank_info->md_reg);
+ md_val = bank_info->md_reg ?
+ readl_relaxed(bank_info->md_reg) : 0;
} else {
ns_mask = clk->ns_mask;
md_val = clk->md_reg ? readl_relaxed(clk->md_reg) : 0;