msm: clock-local2: Correct the check for a null BCR_REG
The address passed into __branch_clk_reset is the
dynamically mapped base plus the register offset of a
BCR_REG. The wrapper reset op should check for a null
instead of this internal function, since the address
passed to the internal function will never be null.
Change-Id: I6c053408338bef8f1faa116ff651e62c4ed1cfd8
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
diff --git a/arch/arm/mach-msm/clock-local2.c b/arch/arm/mach-msm/clock-local2.c
index f9abeef..467d5d1 100644
--- a/arch/arm/mach-msm/clock-local2.c
+++ b/arch/arm/mach-msm/clock-local2.c
@@ -457,17 +457,12 @@
}
static int __branch_clk_reset(void __iomem *bcr_reg,
- enum clk_reset_action action, const char *name)
+ enum clk_reset_action action)
{
int ret = 0;
unsigned long flags;
u32 reg_val;
- if (!bcr_reg) {
- WARN("clk_reset called on an unsupported clock (%s)\n", name);
- return -EPERM;
- }
-
spin_lock_irqsave(&local_clock_reg_lock, flags);
reg_val = readl_relaxed(bcr_reg);
switch (action) {
@@ -492,7 +487,13 @@
static int branch_clk_reset(struct clk *c, enum clk_reset_action action)
{
struct branch_clk *branch = to_branch_clk(c);
- return __branch_clk_reset(BCR_REG(branch), action, c->dbg_name);
+
+ if (!branch->bcr_reg) {
+ WARN("clk_reset called on an unsupported clock (%s)\n",
+ c->dbg_name);
+ return -EPERM;
+ }
+ return __branch_clk_reset(BCR_REG(branch), action);
}
/*
@@ -501,7 +502,13 @@
static int local_vote_clk_reset(struct clk *c, enum clk_reset_action action)
{
struct local_vote_clk *vclk = to_local_vote_clk(c);
- return __branch_clk_reset(BCR_REG(vclk), action, c->dbg_name);
+
+ if (!vclk->bcr_reg) {
+ WARN("clk_reset called on an unsupported clock (%s)\n",
+ c->dbg_name);
+ return -EPERM;
+ }
+ return __branch_clk_reset(BCR_REG(vclk), action);
}
static int local_vote_clk_enable(struct clk *c)