All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Prasad Kumpatla" <prasad.kumpatla@oss.qualcomm.com>
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v2 2/5] ASoC: dt-bindings: qcom: add LPASS LPR vote clock ID
Date: Mon, 13 Jul 2026 18:57:57 +0000	[thread overview]
Message-ID: <20260713185757.D28271F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260713184549.929569-3-prasad.kumpatla@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Adding the clock ID `LPASS_HW_LPR_VOTE` (104) without updating the hardcoded driver limit `Q6DSP_MAX_CLK_ID` causes valid device tree requests to be rejected and creates an out-of-bounds write hazard.
- [High] The driver implementation for the newly added `LPASS_HW_LPR_VOTE` clock ID and `PARAM_ID_RSC_CPU_LPR` parameter is completely missing.
--

--- Patch [2]: [PATCH v2 2/5] ASoC: dt-bindings: qcom: add LPASS LPR vote clock ID ---
commit 806d87026efc23f9d5588f86e5e4c815dd4852cd
Author: Prasad Kumpatla <prasad.kumpatla@oss.qualcomm.com>

ASoC: dt-bindings: qcom: add LPASS LPR vote clock ID

Add a new clock ID, LPASS_HW_LPR_VOTE, to represent the LPASS low-power
resource (LPR) vote through the PRM interface. Also update
Q6AFE_MAX_CLK_ID to account for the newly added clock ID.

> The LPASS PRM supports a resource voting mechanism to control low-power
> states via PARAM_ID_RSC_CPU_LPR. Exposing this as a q6prm clock ID allows
> clients to request the LPR vote using the existing qcom,q6prm clock
> provider interface.

[Severity: High]
Is the driver implementation for this functionality missing from this patch?

Looking at sound/soc/qcom/qdsp6/q6prm-clocks.c, the q6prm_clks[] array does
not appear to map the new LPASS_HW_LPR_VOTE clock ID, which means it will
not be registered during probe.

Additionally, q6prm_set_hw_core_req() hardcodes PARAM_ID_RSC_HW_CORE and
does not seem to have the logic to handle the newly documented
PARAM_ID_RSC_CPU_LPR parameter ID:

sound/soc/qcom/qdsp6/q6prm.c:q6prm_set_hw_core_req() {
    ...
    param_data->param_id = PARAM_ID_RSC_HW_CORE;
    ...
}

Are there corresponding driver changes expected to accompany this binding?

> diff --git a/include/dt-bindings/sound/qcom,q6dsp-lpass-ports.h b/include/dt-bindings/sound/qcom,q6dsp-lpass-ports.h
> index 45850f2d43425..06ca2c287ab2f 100644
> --- a/include/dt-bindings/sound/qcom,q6dsp-lpass-ports.h
> +++ b/include/dt-bindings/sound/qcom,q6dsp-lpass-ports.h
> @@ -236,8 +236,9 @@
>  #define LPASS_HW_AVTIMER_VOTE		101
>  #define LPASS_HW_MACRO_VOTE		102
>  #define LPASS_HW_DCODEC_VOTE		103
> +#define LPASS_HW_LPR_VOTE		104
>  
> -#define Q6AFE_MAX_CLK_ID			104
> +#define Q6AFE_MAX_CLK_ID			105

[Severity: High]
Does the hardcoded limit in the driver also need to be updated to support
this new clock ID?

In sound/soc/qcom/qdsp6/q6dsp-lpass-clocks.c, Q6DSP_MAX_CLK_ID is hardcoded
to 104. Since LPASS_HW_LPR_VOTE is exactly 104, device tree requests for
it will fail the bounds check and be rejected:

sound/soc/qcom/qdsp6/q6dsp-lpass-clocks.c:q6dsp_of_clk_hw_get() {
    ...
    if (idx >= Q6DSP_MAX_CLK_ID || attr > LPASS_CLK_ATTRIBUTE_COUPLE_DIVISOR) {
        dev_err(cc->dev, "Invalid clk specifier (%d, %d)\n", idx, attr);
        return ERR_PTR(-EINVAL);
    }
    ...
}

Also, if the provider driver is updated to register this clock, will it
cause an out-of-bounds array write during probe? The target array seems to
be sized based on the old maximum limit (104 elements):

sound/soc/qcom/qdsp6/q6dsp-lpass-clocks.c:q6dsp_clock_dev_probe() {
    ...
    cc->clks[id] = clk;
    ...
}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260713184549.929569-1-prasad.kumpatla@oss.qualcomm.com?part=2

  reply	other threads:[~2026-07-13 18:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-13 18:45 [PATCH v2 0/5] ASoC: qcom and pinctrl: add LPASS LPR voting and Hawi LPASS LPI TLMM Prasad Kumpatla
2026-07-13 18:45 ` [PATCH v2 1/5] pinctrl: qcom: lpass-lpi: make mutex cleanup devm-managed Prasad Kumpatla
2026-07-13 18:55   ` sashiko-bot
2026-07-13 18:45 ` [PATCH v2 2/5] ASoC: dt-bindings: qcom: add LPASS LPR vote clock ID Prasad Kumpatla
2026-07-13 18:57   ` sashiko-bot [this message]
2026-07-13 18:45 ` [PATCH v2 3/5] ASoC: qcom: q6prm: add support for LPASS LPR resource voting Prasad Kumpatla
2026-07-14  7:43   ` Srinivas Kandagatla
2026-07-14  8:43     ` Prasad Kumpatla
2026-07-13 18:45 ` [PATCH v2 4/5] dt-bindings: pinctrl: qcom,hawi-lpass-lpi-pinctrl: Add Hawi LPI pinctrl Prasad Kumpatla
2026-07-13 18:45 ` [PATCH v2 5/5] pinctrl: qcom: hawi-lpass-lpi: add Hawi LPASS LPI TLMM 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=20260713185757.D28271F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=prasad.kumpatla@oss.qualcomm.com \
    --cc=robh@kernel.org \
    --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.