All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sarath Ganapathiraju" <sarath.ganapathiraju@oss.qualcomm.com>
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org,
	linux-clk@vger.kernel.org
Subject: Re: [PATCH v10 2/2] clk: qcom: Add LPASS VA CSR heartbeat pulse clock
Date: Wed, 30 Sep 2026 10:06:48 +0000	[thread overview]
Message-ID: <20260930100648.BC2B91F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260930-master-v10-2-105207bc5275@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] clk: qcom: missing hardware state restoration on runtime resume
- [Medium] clk: qcom: missing NULL check for of_device_get_match_data()
--

commit 506d9b3aab397203423c9181e755579f9ddb3dd7
Author: Sarath Ganapathiraju <sarath.ganapathiraju@oss.qualcomm.com>

clk: qcom: Add LPASS VA CSR heartbeat pulse clock

This commit adds the LPASS VA CSR driver to model the rate generator as a
clock provider. It attaches DT vote clocks to runtime PM and programs the
rate generator registers during probe.

> diff --git a/drivers/clk/qcom/lpass-va-csr.c b/drivers/clk/qcom/lpass-va-csr.c
> new file mode 100644
> index 0000000000000..b4c0f88187ebb
> --- /dev/null
> +++ b/drivers/clk/qcom/lpass-va-csr.c
[ ... ]
> +static int lpass_va_csr_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	const struct lpass_va_csr_data *data = of_device_get_match_data(dev);
[ ... ]
> +	ret = pm_runtime_resume_and_get(dev);
> +	if (ret)
> +		return ret;
> +
> +	ret = regmap_write(regmap, LPASS_RATE_GEN_COUNTER_0, data->counter_0);

[Severity: Medium]
Is there a risk of a NULL pointer dereference here?

If the device is bound manually via sysfs rather than instantiated through
Device Tree, of_device_get_match_data() will return NULL. The data pointer
is then unconditionally dereferenced when writing to LPASS_RATE_GEN_COUNTER_0
and LPASS_RATE_GEN_DELAY.

[Severity: High]
Does this hardware configuration get lost during runtime suspend and resume
cycles?

When the clock is unprepared by the consumer, the PM runtime reference is
dropped. The pm_clk_suspend callback disables the vote clocks, which can
allow the LPASS power domain to collapse and erase the register context.
The data written here to LPASS_RATE_GEN_COUNTER_0 and LPASS_RATE_GEN_DELAY
is only configured once during probe.

> +	if (ret) {
> +		pm_runtime_put_sync(dev);
> +		return ret;
> +	}
> +
> +	ret = regmap_write(regmap, LPASS_RATE_GEN_DELAY, data->delay);
[ ... ]
> +static const struct dev_pm_ops lpass_va_csr_pm_ops = {
> +	SET_RUNTIME_PM_OPS(pm_clk_suspend, pm_clk_resume, NULL)
> +};

[Severity: High]
Should there be a regcache_sync() call to restore the hardware state?

Because the generic pm_clk_resume is used directly without an additional
wrapper that syncs the regmap cache, the counter and delay registers are
not reprogrammed after waking up from runtime suspend. The subsequent
clk_enable_regmap() will only write the control register, leaving the
hardware with uninitialized or reset parameters which could break audio
DMAs and codec synchronization.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260930-master-v10-0-105207bc5275@oss.qualcomm.com?part=2

  reply	other threads:[~2026-09-30 10:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30  9:51 [PATCH v10 0/2] Add LPASS VA CSR HeartBeat pulse clock support Sarath Ganapathiraju
2026-09-30  9:51 ` Sarath Ganapathiraju via B4 Relay
2026-09-30  9:51 ` [PATCH v10 1/2] dt-bindings: clock: qcom: Add LPASS VA CSR HeartBeat pulse clock Sarath Ganapathiraju
2026-09-30  9:51   ` Sarath Ganapathiraju via B4 Relay
2026-09-30  9:51 ` [PATCH v10 2/2] clk: qcom: Add LPASS VA CSR heartbeat " Sarath Ganapathiraju
2026-09-30  9:51   ` Sarath Ganapathiraju via B4 Relay
2026-09-30 10:06   ` sashiko-bot [this message]
2026-10-05  6:06   ` Ajay Kumar Nandam
2026-10-12  9:00     ` Sarath Ganapathiraju
2026-09-30 17:05 ` [PATCH v10 0/2] Add LPASS VA CSR HeartBeat pulse clock support Prasad Kumpatla

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=20260930100648.BC2B91F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sarath.ganapathiraju@oss.qualcomm.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.