From: sashiko-bot@kernel.org
To: "Mohammad Rafi Shaik" <mohammad.rafi.shaik@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v3 3/3] ASoC: qcom: sc8280xp: ASoC: qcom: sc8280xp: enhance machine driver for board-specific config
Date: Mon, 06 Jul 2026 13:34:27 +0000 [thread overview]
Message-ID: <20260706133428.8138E1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260706132009.1496321-4-mohammad.rafi.shaik@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Backend DAI operations are erroneously attached to DPCM Frontend links due to a flawed `link->num_codecs > 0` condition.
- [Low] Board-specific `snd_soc_common` match data structures are missing the `const` qualifier.
--
commit a4f95b828cd79a0224347fb7462baf2aac9d444d
Author: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
Subject: ASoC: qcom: sc8280xp: ASoC: qcom: sc8280xp: enhance machine driver for board-specific config
The sc8280xp machine driver is currently written with a largely SoC-centric
view and assumes a uniform audio topology across all boards. This change
enhances the driver to support board-specific configuration such as allowing
each board variant to provide its own DAPM widgets and routes.
> diff --git a/sound/soc/qcom/sc8280xp.c b/sound/soc/qcom/sc8280xp.c
> index 7925aa3f63ba0..b13f39dc5afc2 100644
> --- a/sound/soc/qcom/sc8280xp.c
> +++ b/sound/soc/qcom/sc8280xp.c
[ ... ]
> @@ -127,7 +245,7 @@ static void sc8280xp_add_be_ops(struct snd_soc_card *card)
> int i;
>
> for_each_card_prelinks(card, i, link) {
> - if (link->no_pcm == 1) {
> + if (link->no_pcm == 1 || link->num_codecs > 0) {
[Severity: High]
Does this unintentionally match DPCM frontend links as well?
Looking at qcom_snd_parse_of(), it explicitly assigns a dummy codec and sets
link->num_codecs = 1 for all DPCM frontend links:
sound/soc/qcom/common.c:qcom_snd_parse_of() {
...
if (codec) {
...
} else {
/* DPCM frontend */
link->codecs = &snd_soc_dummy_dlc;
link->num_codecs = 1;
link->dynamic = 1;
}
...
}
This means link->num_codecs > 0 will evaluate to true for every link on the
card, attaching sc8280xp_be_ops and sc8280xp_snd_init to frontend links. If
sc8280xp_snd_prepare() is then invoked for frontend links, it will index the
data->stream_prepared array using frontend CPU DAI IDs. Could this result in
state corruption or out-of-bounds memory accesses if these IDs exceed
AFE_PORT_MAX?
Should this condition check !link->dynamic to safely exclude frontend links?
> link->init = sc8280xp_snd_init;
> link->be_hw_params_fixup = sc8280xp_be_hw_params_fixup;
> link->ops = &sc8280xp_be_ops;
[ ... ]
> @@ -145,37 +263,124 @@ static int sc8280xp_platform_probe(struct platform_device *pdev)
> card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL);
> if (!card)
> return -ENOMEM;
> - card->owner = THIS_MODULE;
> +
> /* Allocate the private data */
> data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
> if (!data)
> return -ENOMEM;
>
> + data->snd_soc_common_priv = (struct snd_soc_common *)of_device_get_match_data(dev);
[Severity: Low]
This isn't a bug, but can we avoid this explicit cast by declaring the private
data structures as const?
The of_device_get_match_data() function returns a const void *. Since the
matched data structures are not modified at runtime, could we declare them as
static const and update the snd_soc_common_priv pointer in sc8280xp_snd_data
to be const as well?
> + if (!data->snd_soc_common_priv)
> + return -ENODEV;
> +
> + card->owner = THIS_MODULE;
[ ... ]
> +static struct snd_soc_common kaanapali_priv_data = {
[Severity: Low]
This isn't a bug, but should this and the other snd_soc_common match data
structures introduced below be declared as static const to place them in the
read-only .rodata section?
> + .driver_name = "kaanapali",
> + .dapm_widgets = sc8280xp_dapm_widgets,
> + .num_dapm_widgets = ARRAY_SIZE(sc8280xp_dapm_widgets),
> + .wcd_jack = true,
> +};
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260706132009.1496321-1-mohammad.rafi.shaik@oss.qualcomm.com?part=3
prev parent reply other threads:[~2026-07-06 13:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-06 13:20 [PATCH v3 0/3] ASoC: qcom: qdsp6: Add MI2S clock control Mohammad Rafi Shaik
2026-07-06 13:20 ` [PATCH v3 1/3] ASoC: dt-bindings: qcom,q6apm-lpass-dais: Document DAI subnode Mohammad Rafi Shaik
2026-07-06 13:30 ` sashiko-bot
2026-07-06 13:20 ` [PATCH v3 2/3] ASoC: qcom: q6apm-lpass-dais: Add MI2S clock control Mohammad Rafi Shaik
2026-07-06 13:33 ` sashiko-bot
2026-07-06 18:18 ` Mark Brown
2026-07-06 13:20 ` [PATCH v3 3/3] ASoC: qcom: sc8280xp: ASoC: qcom: sc8280xp: enhance machine driver for board-specific config Mohammad Rafi Shaik
2026-07-06 13:34 ` sashiko-bot [this message]
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=20260706133428.8138E1F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=mohammad.rafi.shaik@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox