[PATCH v3 4/7] ASoC: meson: add AUDIN driver

sashiko-bot at kernel.org sashiko-bot at kernel.org
Tue Sep 22 09:17:10 PDT 2026


Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] sound: soc: meson: data race due to global state modification in probe
--

commit 19f0be491d181acce1da0bdd85fd37b9549fa25c
Author: Valerio Setti <vsetti at baylibre.com>

ASoC: meson: add AUDIN driver

This commit adds the AUDIN driver to provide audio input support for Amlogic
GX based platforms. It incorporates FIFO handling and an I2S data formatter to
route audio streams.

> diff --git a/sound/soc/meson/audin.c b/sound/soc/meson/audin.c
> new file mode 100644
> index 0000000000000..15824354abede
> --- /dev/null
> +++ b/sound/soc/meson/audin.c
[ ... ]
> +static struct snd_soc_dapm_widget audin_dapm_widgets[] = {
> +	[AUDIN_WIDGET_I2S_FORMATTER] =
> +		SND_SOC_DAPM_PGA_E("I2S Formatter", SND_SOC_NOPM, 0, 0, NULL, 0,
> +				   gx_formatter_event,
> +				   (SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD)),
> +	SND_SOC_DAPM_MUX("FIFO0 SRC SEL", SND_SOC_NOPM, 0, 0,
> +			 &audin_fifo0_input_sel_mux),
[ ... ]
> +static int audin_probe(struct platform_device *pdev)
> +{
[ ... ]
> +	ret = gx_formatter_create(dev, &audin_dapm_widgets[AUDIN_WIDGET_I2S_FORMATTER],
> +				  &audin_formatter_i2s_drv, regmap);

[Severity: Low]
Is it safe to mutate the static audin_dapm_widgets array here in audin_probe()
with a per-device allocated pointer?

Calling gx_formatter_create() modifies w->priv where w points to the static
global audin_dapm_widgets array.

While ASoC's snd_soc_dapm_new_controls() uses kmemdup() to clone widget
templates, modifying shared static global structs without synchronization
introduces a structural data race if multiple instances are probed
concurrently. This also appears to violate driver design principles against
modifying static templates.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260922-audin-v3-0-a760312c076c@baylibre.com?part=4



More information about the linux-amlogic mailing list