Skip to contentSkip to conversation

clk: qcom: clk-krait: fix wrong div2 functions

PATCH Applied Christian Marangi 2 participants 2 messages Nov 8, 2022 – Dec 2, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: qcom: clk-krait: fix wrong div2 functions

Currently div2 value is applied to the wrong bits. This is caused by a bug in the code where the shift is done only for lpl, for anything else the mask is not shifted to the correct bits.

Fix this by correctly shift if lpl is not supported.

Fixes 4d7dc77babfe ("clk: qcom: Add support for Krait clocks")
---
 drivers/clk/qcom/clk-krait.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/clk/qcom/clk-krait.c +2 -0
index 45da736bd5f4..293a9dfa7151 100644
@@ -114,6 +114,8 @@ static int krait_div2_set_rate(struct clk_hw *hw, unsigned long rate,
 
 	if (d->lpl)
 		mask = mask << (d->shift + LPL_SHIFT) | mask << d->shift;
+	else
+		mask <<= d->shift;
 
 	spin_lock_irqsave(&krait_clock_reg_lock, flags);
 	val = krait_get_l2_indirect_reg(d->offset);
Signature · 1 line
2.37.2
maintainer Applied
#1 lore raw
Quoted 8 lines · Christian Marangi

Currently div2 value is applied to the wrong bits. This is caused by a bug in the code where the shift is done only for lpl, for anything else the mask is not shifted to the correct bits.

Fix this by correctly shift if lpl is not supported.

[...]

Applied, thanks!

[1/1] clk: qcom: clk-krait: fix wrong div2 functions

      commit: d676d3a3717cf726d3affedbe5ba98fc4ccad7b3

Best regards,

Signature · 1 line
Bjorn Andersson <[email protected]>