[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <140e036792e7d7468130a47b0724132d.sboyd@kernel.org>
Date: Mon, 02 Dec 2024 21:08:38 -0800
From: Stephen Boyd <sboyd@...nel.org>
To: Bjorn Andersson <andersson@...nel.org>, Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>, Michael Turquette <mturquette@...libre.com>, linux-arm-msm@...r.kernel.org, linux-clk@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
Subject: Re: [PATCH] clk: qcom: clk-alpha-pll: Do not use random stack value for recalc rate
Quoting Krzysztof Kozlowski (2024-11-27 01:36:23)
> If regmap_read() fails, random stack value was used in calculating new
> frequency in recalc_rate() callbacks. Such failure is really not
> expected as these are all MMIO reads, however code should be here
> correct and bail out. This also avoids possible warning on
> uninitialized value.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
> ---
> drivers/clk/qcom/clk-alpha-pll.c | 41 ++++++++++++++++++++++----------
> 1 file changed, 29 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/clk/qcom/clk-alpha-pll.c b/drivers/clk/qcom/clk-alpha-pll.c
> index 5e9217ea3760..0cd937ab47d0 100644
> --- a/drivers/clk/qcom/clk-alpha-pll.c
> +++ b/drivers/clk/qcom/clk-alpha-pll.c
> @@ -682,9 +682,12 @@ clk_alpha_pll_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
> struct clk_alpha_pll *pll = to_clk_alpha_pll(hw);
> u32 alpha_width = pll_alpha_width(pll);
>
> - regmap_read(pll->clkr.regmap, PLL_L_VAL(pll), &l);
> + if (regmap_read(pll->clkr.regmap, PLL_L_VAL(pll), &l))
> + return 0;
> +
> + if (regmap_read(pll->clkr.regmap, PLL_USER_CTL(pll), &ctl))
> + return 0;
>
> - regmap_read(pll->clkr.regmap, PLL_USER_CTL(pll), &ctl);
> if (ctl & PLL_ALPHA_EN) {
> regmap_read(pll->clkr.regmap, PLL_ALPHA_VAL(pll), &low);
What about 'low'?
> if (alpha_width > 32) {
Powered by blists - more mailing lists