[PATCH 1/2] ASoC: meson: card: leave the device drvdata to the ASoC card
From: Jerome Brunet
Date: Fri Oct 30 2026 - 12:33:49 EST
snd_soc_register_card() sets the device drvdata to the card, so
meson_card_remove() gets the card, not the meson_card it expects. The
card is not the first member of meson_card, so the links are read from
the wrong place and remove() crashes on unbind or rmmod.
Get priv from the card and drop the platform_set_drvdata() call that
the card registration overrides.
Fixes: aa9c3b7273a5 ("ASoC: meson: axg: extract sound card utils")
Signed-off-by: Jerome Brunet <jbrunet@xxxxxxxxxxxx>
---
sound/soc/meson/meson-card-utils.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/meson/meson-card-utils.c b/sound/soc/meson/meson-card-utils.c
index f2796dc84fa5..3cdc73b3fe8b 100644
--- a/sound/soc/meson/meson-card-utils.c
+++ b/sound/soc/meson/meson-card-utils.c
@@ -276,7 +276,6 @@ int meson_card_probe(struct platform_device *pdev)
if (!priv)
return -ENOMEM;
- platform_set_drvdata(pdev, priv);
snd_soc_card_set_drvdata(&priv->card, priv);
priv->card.owner = THIS_MODULE;
@@ -324,7 +323,8 @@ EXPORT_SYMBOL_GPL(meson_card_probe);
void meson_card_remove(struct platform_device *pdev)
{
- struct meson_card *priv = platform_get_drvdata(pdev);
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+ struct meson_card *priv = snd_soc_card_get_drvdata(card);
meson_card_clean_references(priv);
}
--
2.53.0