On 07/14, Andy Shevchenko wrote:
> Sparse complains about possible imbalance in locking.
>
> drivers/clk/clk-fractional-divider.c:37:9: warning: context imbalance in
> 'clk_fd_recalc_rate' - different lock contexts for basic block
> drivers/clk/clk-fractional-divider.c:61:12: warning: context imbalance in
> 'clk_fd_set_rate' - different lock contexts for basic block
>
> Let's rewrite code to fix this and make it more straight.
>
> Signed-off-by: Andy Shevchenko <[email protected]>
> ---
> drivers/clk/clk-fractional-divider.c | 44
> +++++++++++++++++++++---------------
This can be "fixed" with far fewer lines of code.
drivers/clk/clk-fractional-divider.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/clk/clk-fractional-divider.c
b/drivers/clk/clk-fractional-divider.c
index 140eb5844dc4..e85f856b8592 100644
--- a/drivers/clk/clk-fractional-divider.c
+++ b/drivers/clk/clk-fractional-divider.c
@@ -27,11 +27,15 @@ static unsigned long clk_fd_recalc_rate(struct clk_hw *hw,
if (fd->lock)
spin_lock_irqsave(fd->lock, flags);
+ else
+ __acquire(fd->lock);
val = clk_readl(fd->reg);
if (fd->lock)
spin_unlock_irqrestore(fd->lock, flags);
+ else
+ __release(fd->lock);
m = (val & fd->mmask) >> fd->mshift;
n = (val & fd->nmask) >> fd->nshift;
@@ -80,6 +84,8 @@ static int clk_fd_set_rate(struct clk_hw *hw, unsigned long
rate,
if (fd->lock)
spin_lock_irqsave(fd->lock, flags);
+ else
+ __acquire(fd->lock);
val = clk_readl(fd->reg);
val &= ~(fd->mmask | fd->nmask);
@@ -88,6 +94,8 @@ static int clk_fd_set_rate(struct clk_hw *hw, unsigned long
rate,
if (fd->lock)
spin_unlock_irqrestore(fd->lock, flags);
+ else
+ __release(fd->lock);
return 0;
}
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/