Linux Sound subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Kuninori Morimoto" <kuninori.morimoto.gx@renesas.com>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH v2 09/27] ASoC: soc-devres: use snd_soc_component_unregister() for devm_snd_soc_register_component()
Date: Thu, 12 Nov 2026 01:45:16 +0000	[thread overview]
Message-ID: <sashiko-outbox-210088@kernel.org> (raw)
In-Reply-To: <87mrre28kj.wl-kuninori.morimoto.gx@renesas.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] ASoC: soc-devres: double list_del() in devm_component_release()
  on teardown
--

commit 38a63673c76cb0aea6b0a6701713c1de6335cb5e
Author: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-devres: use snd_soc_component_unregister() for devm_snd_soc_register_component()

This commit changes devm_snd_soc_register_component() to store the
registered struct snd_soc_component pointer in devres and pass it
directly to snd_soc_component_unregister() on release.

> diff --git a/sound/soc/soc-devres.c b/sound/soc/soc-devres.c
> index ca6c29b54f6ab..0323897c664dc 100644
> --- a/sound/soc/soc-devres.c
> +++ b/sound/soc/soc-devres.c
> @@ -11,9 +11,9 @@
>  
>  static void devm_component_release(struct device *dev, void *res)
>  {
> -	const struct snd_soc_component_driver **cmpnt_drv = res;
> +	struct snd_soc_component **component = res;
>  
> -	snd_soc_unregister_component_by_driver(dev, *cmpnt_drv);
> +	snd_soc_component_unregister(*component);
>  }

[Severity: High]
Can devm_component_release() call list_del(&component->list) a second
time if the driver already called snd_soc_unregister_component(dev)?

Previously, snd_soc_unregister_component_by_driver() looked up the
component on component_list first, making devm_component_release() a
no-op if it had already been removed.  Now, calling
snd_soc_component_unregister(*component) directly invokes
snd_soc_component_unregister_unlocked(), which unconditionally runs
list_del(&component->list) without checking whether the component is
still linked.

Drivers that mix devm_snd_soc_register_component() with
snd_soc_unregister_component(dev) will hit a double list_del() on a
poisoned list head during teardown:

sound/soc/mediatek/mt8173/mt8173-afe-pcm.c:mt8173_afe_pcm_dev_probe() {
	...
	ret = devm_snd_soc_register_component(dev, &mtk_afe_pcm_platform,
					      NULL, 0);
	if (ret)
		goto err_pm;

	ret = snd_soc_register_component(dev,
					 &mt8173_afe_pcm_dai_component,
					 mt8173_afe_pcm_dais,
					 ARRAY_SIZE(mt8173_afe_pcm_dais));
	...
err_cleanup_components:
	snd_soc_unregister_component(dev);
	...
}

mt8173_afe_pcm_dev_remove(), stm32_adfsdm_remove(), and tas_remove() in
sound/soc/codecs/tas2783-sdw.c also call snd_soc_unregister_component()
before devres_release_all() runs devm_component_release().

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/87zeve28ol.wl-kuninori.morimoto.gx@renesas.com?part=9

  reply	other threads:[~2026-11-12  1:45 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12  0:30 [PATCH v2 00/27] ASoC: add new Component functions Kuninori Morimoto
2026-11-12  0:30 ` [PATCH v2 01/27] ASoC: soc-generic-dmaengine-pcm: move devm_snd_dmaengine_pcm_register() Kuninori Morimoto
2026-11-12  0:30 ` [PATCH v2 02/27] ASoC: soc-component: rename snd_soc_component_{init/exit}_regmap() to snd_soc_component_regmap_{init/exit}() Kuninori Morimoto
2026-11-12 12:57   ` Alvin Šipraga
2026-11-12  0:31 ` [PATCH v2 03/27] ASoC: soc-component: rename snd_soc_component_regmap_val_bytes() Kuninori Morimoto
2026-11-12 12:57   ` Alvin Šipraga
2026-11-12  0:31 ` [PATCH v2 04/27] ASoC: soc-component: rename snd_soc_component_regmap_cache_sync() Kuninori Morimoto
2026-11-12 12:58   ` Alvin Šipraga
2026-11-12  0:31 ` [PATCH v2 05/27] ASoC: soc-component: align snd_soc_component_{regmap/regcache}_xxx() functions Kuninori Morimoto
2026-11-12 12:58   ` Alvin Šipraga
2026-11-12  0:31 ` [PATCH v2 06/27] ASoC: soc-core: move snd_soc_del_component_unlocked() Kuninori Morimoto
2026-11-12 12:58   ` Alvin Šipraga
2026-11-12  0:32 ` [PATCH v2 07/27] ASoC: soc-core: add missing snd_soc_component_unregister() Kuninori Morimoto
2026-11-12 12:59   ` Alvin Šipraga
2026-11-12  0:32 ` [PATCH v2 08/27] ASoC: soc-generic-dmaengine-pcm: use snd_soc_component_unregister() Kuninori Morimoto
2026-11-12 12:59   ` Alvin Šipraga
2026-11-12 13:53   ` Alvin Šipraga
2026-11-12  0:32 ` [PATCH v2 09/27] ASoC: soc-devres: use snd_soc_component_unregister() for devm_snd_soc_register_component() Kuninori Morimoto
2026-11-12  1:45   ` sashiko-bot [this message]
2026-11-12  3:20     ` Kuninori Morimoto
2026-11-12  0:32 ` [PATCH v2 10/27] ASoC: soc-core: remove snd_soc_unregister_component_by_driver() Kuninori Morimoto
2026-11-12  0:32 ` [PATCH v2 11/27] ASoC: soc-component: move snd_soc_register_[un]component() to soc-component.c Kuninori Morimoto
2026-11-12  0:32 ` [PATCH v2 12/27] ASoC: soc-component: move devm_snd_soc_component_register() Kuninori Morimoto
2026-11-12  0:32 ` [PATCH v2 13/27] ASoC: soc-component: move snd_soc_of_xlate_dai_name() to soc-component.c Kuninori Morimoto
2026-11-12  0:32 ` [PATCH v2 14/27] ASoC: soc-component: add snd_soc_component_name_prefix() Kuninori Morimoto
2026-11-12  0:33 ` [PATCH v2 15/27] ASoC: soc-component: add snd_soc_component_to_dev() Kuninori Morimoto
2026-11-12  0:33 ` [PATCH v2 16/27] ASoC: soc-component: add snd_soc_component_to_driver() Kuninori Morimoto
2026-11-12  0:33 ` [PATCH v2 17/27] ASoC: soc-component: add snd_soc_component_to_card() Kuninori Morimoto
2026-11-12  0:33 ` [PATCH v2 18/27] ASoC: soc-component: add snd_soc_component_to_debugfs_root() Kuninori Morimoto
2026-11-12  0:33 ` [PATCH v2 19/27] ASoC: soc-component: add snd_soc_component_to_regmap() Kuninori Morimoto
2026-11-12  0:33 ` [PATCH v2 20/27] ASoC: soc-component: add snd_soc_component_regcache_mark_dirty() Kuninori Morimoto
2026-11-12  0:33 ` [PATCH v2 21/27] ASoC: soc-component: add snd_soc_component_regcache_cache_only() Kuninori Morimoto
2026-11-12  0:33 ` [PATCH v2 22/27] ASoC: soc-component: add snd_soc_component_regcache_cache_bypass() Kuninori Morimoto
2026-11-12  0:33 ` [PATCH v2 23/27] ASoC: soc-component: add snd_soc_component_regmap_multi_reg_write_bypassed() Kuninori Morimoto
2026-11-12  0:33 ` [PATCH v2 24/27] ASoC: soc-component: add snd_soc_component_num_dai() Kuninori Morimoto
2026-11-12  0:33 ` [PATCH v2 25/27] ASoC: soc-component: add snd_soc_component_connect_dai() Kuninori Morimoto
2026-11-12  0:33 ` [PATCH v2 26/27] ASoC: soc-component: add snd_soc_component_active_update() Kuninori Morimoto
2026-11-12  0:33 ` [PATCH v2 27/27] ASoC: soc-component: add snd_soc_component_device_link_{add/del}() Kuninori Morimoto

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=sashiko-outbox-210088@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=linux-sound@vger.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