From: Stephen Boyd <sboyd@kernel.org>
To: Bjorn Andersson <andersson@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
Michael Turquette <mturquette@baylibre.com>,
linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Subject: Re: [PATCH] clk: qcom: clk-alpha-pll: Do not use random stack value for recalc rate
Date: Mon, 02 Dec 2024 21:08:38 -0800 [thread overview]
Message-ID: <140e036792e7d7468130a47b0724132d.sboyd@kernel.org> (raw)
In-Reply-To: <20241127093623.80735-1-krzysztof.kozlowski@linaro.org>
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@linaro.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) {
next prev parent reply other threads:[~2024-12-03 5:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-27 9:36 [PATCH] clk: qcom: clk-alpha-pll: Do not use random stack value for recalc rate Krzysztof Kozlowski
2024-12-03 5:08 ` Stephen Boyd [this message]
2024-12-03 7:21 ` Krzysztof Kozlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=140e036792e7d7468130a47b0724132d.sboyd@kernel.org \
--to=sboyd@kernel.org \
--cc=andersson@kernel.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.