From: sashiko-bot@kernel.org
To: "Srinivas Kandagatla" <srinivas.kandagatla@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v5 3/7] ASoC: SDCA: expose class SoundWire probe/remove as library
Date: Fri, 25 Sep 2026 16:21:25 +0000 [thread overview]
Message-ID: <20260925162125.83B2D1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260925161049.758913-4-srinivas.kandagatla@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] sdca: API contract violation causes type confusion risk in class_function_probe()
--
commit d168d671e23f5aecfdc67da7d941b185751c5190
Author: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
ASoC: SDCA: expose class SoundWire probe/remove as library
This commit splits the internal class_sdw_probe and class_sdw_remove
functions into exported library helpers. Codec-specific SoundWire drivers
can now embed the class state in their own private structure and manage
dev_set_drvdata() themselves to keep per-slave state.
> diff --git a/sound/soc/sdca/sdca_class.c b/sound/soc/sdca/sdca_class.c
> index a092ebaa620aa..0e6dead414959 100644
> --- a/sound/soc/sdca/sdca_class.c
> +++ b/sound/soc/sdca/sdca_class.c
> @@ -136,18 +136,31 @@ static void class_boot_work(struct work_struct *work)
> pm_runtime_put_sync(drv->dev);
> }
>
> -static int class_sdw_probe(struct sdw_slave *sdw, const struct sdw_device_id *id)
> +/**
> + * sdca_class_probe - SDCA class SoundWire slave probe helper
> + * @sdw: SoundWire slave
> + * @drv: caller-allocated sdca_class_drv storage. The caller (a codec
> + * driver, or the built-in class_sdw_driver in this file) owns the
> + * allocation and sets its own dev_set_drvdata() -- the framework
> + * does not touch drvdata. Typically embedded in the codec's own
> + * priv struct so codec drivers can keep per-slave state.
> + *
> + * Codec-specific SoundWire drivers call this from their .probe after
> + * allocating a struct sdca_class_drv (usually embedded in their own
> + * priv) and setting drvdata to their priv. The framework fills in the
> + * sdca_class_drv fields, sets up the class regmap, and queues the
> + * deferred boot work.
> + */
> +int sdca_class_probe(struct sdw_slave *sdw, struct sdca_class_drv *drv)
[Severity: Medium]
Does this documentation accurately reflect how struct sdca_class_drv is
fetched by the framework?
If a codec driver embeds struct sdca_class_drv at a non-zero offset within
its private struct and sets drvdata to the private struct, won't this cause
type confusion in class_function_probe()?
sound/soc/sdca/sdca_class_function.c:class_function_probe() {
...
struct sdca_class_drv *core = dev_get_drvdata(dev->parent);
...
}
Here, class_function_probe() fetches the parent's drvdata (the SoundWire
device) and blindly casts it to struct sdca_class_drv *. If the codec
driver's private struct has sdca_class_drv at a non-zero offset, this will
lead to a corrupted pointer.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260925161049.758913-1-srinivas.kandagatla@oss.qualcomm.com?part=3
next prev parent reply other threads:[~2026-09-25 16:21 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-25 16:10 [PATCH v5 0/7] ASoC: Qualcomm Tambora (WCD9378) SDCA codec Srinivas Kandagatla
2026-09-25 16:10 ` [PATCH v5 1/7] ASoC: SDCA: allow building without ACPI Srinivas Kandagatla
2026-09-28 9:32 ` Charles Keepax
2026-09-25 16:10 ` [PATCH v5 2/7] ASoC: SDCA: export PM helpers keyed on sdca_class_drv Srinivas Kandagatla
2026-09-28 9:32 ` Charles Keepax
2026-09-25 16:10 ` [PATCH v5 3/7] ASoC: SDCA: expose class SoundWire probe/remove as library Srinivas Kandagatla
2026-09-25 16:21 ` sashiko-bot [this message]
2026-09-28 9:34 ` Charles Keepax
2026-09-25 16:10 ` [PATCH v5 4/7] ASoC: SDCA: add class_ops with populate_function Srinivas Kandagatla
2026-09-28 9:34 ` Charles Keepax
2026-09-25 16:10 ` [PATCH v5 5/7] ASoC: SDCA: class_function: xlate sound-dai cell by entity index Srinivas Kandagatla
2026-09-28 9:35 ` Charles Keepax
2026-09-25 16:10 ` [PATCH v5 6/7] ASoC: dt-bindings: qcom: add Tambora WCD9378 SDCA codec Srinivas Kandagatla
2026-09-29 8:22 ` Krzysztof Kozlowski
2026-09-25 16:10 ` [PATCH v5 7/7] ASoC: codecs: add Qualcomm Tambora (WCD9378) " Srinivas Kandagatla
2026-09-25 17:31 ` Mark Brown
2026-09-25 20:28 ` Srinivas Kandagatla
2026-09-25 21:52 ` Mark Brown
2026-09-29 11:51 ` [PATCH v5 0/7] ASoC: " Mark Brown
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=20260925162125.83B2D1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=srinivas.kandagatla@oss.qualcomm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox