]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
clk: stm32: Wrong macros used in register read
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Thu, 24 Jul 2025 11:37:38 +0000 (12:37 +0100)
committerPatrice Chotard <patrice.chotard@foss.st.com>
Tue, 29 Jul 2025 15:02:31 +0000 (17:02 +0200)
Smatch reported a warning about a shift macro being used as a mask. Make
the obvious changes to make this register read calculation work the same
as the previous ones.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
drivers/clk/stm32/clk-stm32h7.c

index aa3be414a29f8fd8d291a3958d199d8859ceaedb..df82db69738a5d9704592d5cdbec52125c0620a1 100644 (file)
@@ -549,8 +549,8 @@ static u32 stm32_get_PLL1_rate(struct stm32_rcc_regs *regs,
        divr1 = readl(&regs->pll1divr) & RCC_PLL1DIVR_DIVR1_MASK;
        divr1 = (divr1 >> RCC_PLL1DIVR_DIVR1_SHIFT) + 1;
 
-       fracn1 = readl(&regs->pll1fracr) & RCC_PLL1DIVR_DIVR1_MASK;
-       fracn1 = fracn1 & RCC_PLL1DIVR_DIVR1_SHIFT;
+       fracn1 = readl(&regs->pll1fracr) & RCC_PLL1FRACR_FRACN1_MASK;
+       fracn1 = (fracn1 >> RCC_PLL1FRACR_FRACN1_SHIFT) + 1;
 
        vco = (pllsrc / divm1) * divn1;
        rate = (pllsrc * fracn1) / (divm1 * 8192);