From: Herman van Hazendonk <github.com@herrie.org>
To: sboyd@kernel.org
Cc: Herman van Hazendonk <github.com@herrie.org>,
Bjorn Andersson <andersson@kernel.org>,
Michael Turquette <mturquette@baylibre.com>,
linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] clk: qcom: lcc-msm8960: check regmap_read/regmap_write return values in probe
Date: Tue, 2 Jun 2026 06:49:59 +0200 [thread overview]
Message-ID: <20260602045002.290918-2-github.com@herrie.org> (raw)
In-Reply-To: <20260602045002.290918-1-github.com@herrie.org>
The PLL4 L-register read in probe was used to select between the 393 MHz
and 492 MHz frequency plans without checking whether the underlying
regmap operation succeeded; a silent failure would leave the rcg
structures pointing at whatever default they had at startup (the 393
MHz plan) and the chosen plan could be wrong for the running PLL,
producing incorrect audio clock rates without any diagnostic.
The unconditional write to register 0xc4 that arms the LPASS Primary
PLL mux on PLL4 had the same problem: a bus-level failure would leave
the mux at its default (PXO) and every downstream LCC clock would be
sourced from the wrong parent without a warning.
Use dev_err_probe() in both spots so the error is surfaced (and the
deferred-probe state machine handles the EPROBE_DEFER-from-bus-arbiter
case correctly) and the driver does not bind in a known-bad
configuration.
Signed-off-by: Herman van Hazendonk <github.com@herrie.org>
---
drivers/clk/qcom/lcc-msm8960.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/qcom/lcc-msm8960.c b/drivers/clk/qcom/lcc-msm8960.c
index 7cba2ce3e408..44321c01f957 100644
--- a/drivers/clk/qcom/lcc-msm8960.c
+++ b/drivers/clk/qcom/lcc-msm8960.c
@@ -453,6 +453,7 @@ MODULE_DEVICE_TABLE(of, lcc_msm8960_match_table);
static int lcc_msm8960_probe(struct platform_device *pdev)
{
u32 val;
+ int ret;
struct regmap *regmap;
/* patch for the cxo <-> pxo difference */
@@ -468,7 +469,10 @@ static int lcc_msm8960_probe(struct platform_device *pdev)
return PTR_ERR(regmap);
/* Use the correct frequency plan depending on speed of PLL4 */
- regmap_read(regmap, 0x4, &val);
+ ret = regmap_read(regmap, 0x4, &val);
+ if (ret)
+ return dev_err_probe(&pdev->dev, ret,
+ "failed to read PLL4 L register\n");
if (val == 0x12) {
slimbus_src.freq_tbl = clk_tbl_aif_osr_492;
mi2s_osr_src.freq_tbl = clk_tbl_aif_osr_492;
@@ -479,7 +483,10 @@ static int lcc_msm8960_probe(struct platform_device *pdev)
pcm_src.freq_tbl = clk_tbl_pcm_492;
}
/* Enable PLL4 source on the LPASS Primary PLL Mux */
- regmap_write(regmap, 0xc4, 0x1);
+ ret = regmap_write(regmap, 0xc4, 0x1);
+ if (ret)
+ return dev_err_probe(&pdev->dev, ret,
+ "failed to select PLL4 on LPASS Primary PLL Mux\n");
return qcom_cc_really_probe(&pdev->dev, &lcc_msm8960_desc, regmap);
}
--
2.43.0
next parent reply other threads:[~2026-06-02 4:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260602045002.290918-1-github.com@herrie.org>
2026-06-02 4:49 ` Herman van Hazendonk [this message]
2026-06-02 4:50 ` [PATCH 2/3] clk: qcom: lcc-msm8960: serialise probe and block sysfs rebind Herman van Hazendonk
2026-06-02 4:50 ` [PATCH 3/3] clk: qcom: lcc-msm8960: re-apply PLL4 mux on resume Herman van Hazendonk
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=20260602045002.290918-2-github.com@herrie.org \
--to=github.com@herrie.org \
--cc=andersson@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox