genio-7.2: fix from rabbit for MT ASoC patch

This commit is contained in:
Ricardo Pardini
2026-08-30 23:35:03 +02:00
parent 62cd8c2470
commit daeae3577e
@@ -37,21 +37,24 @@ still probing, and dies there. Whether this is hit at all comes down to
module load order, so the same kernel and config can work on one distro
and fail on another.
Only release the references once card->instantiated confirms that the
card is bound.
Only hold on to the references in that deferred case, which is the only
one where devm_snd_soc_register_card() returns 0 without the card being
instantiated. Release them as before once card->instantiated confirms
the bind, and also when registration failed for good, so a terminal
error does not leak them.
Fixes: bce93a162505 ("ASoC: mediatek: Add common machine soundcard driver probe mechanism")
Assisted-by: Claude:claude-opus-5
Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
---
sound/soc/mediatek/common/mtk-soundcard-driver.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
sound/soc/mediatek/common/mtk-soundcard-driver.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/sound/soc/mediatek/common/mtk-soundcard-driver.c b/sound/soc/mediatek/common/mtk-soundcard-driver.c
index 111111111111..222222222222 100644
--- a/sound/soc/mediatek/common/mtk-soundcard-driver.c
+++ b/sound/soc/mediatek/common/mtk-soundcard-driver.c
@@ -325,7 +325,12 @@ int mtk_soundcard_common_probe(struct platform_device *pdev)
@@ -325,7 +325,13 @@ int mtk_soundcard_common_probe(struct platform_device *pdev)
ret = devm_snd_soc_register_card(&pdev->dev, card);
@@ -59,9 +62,10 @@ index 111111111111..222222222222 100644
+ /*
+ * A card whose binding was deferred is queued for a later retry and
+ * reported back as success. That retry reuses the DAI link info parsed
+ * here, so only drop our references once the card is really bound.
+ * here, so keep our references in that case only: drop them once the
+ * card is bound, or when registration failed for good.
+ */
+ if (!needs_legacy_probe && card->instantiated)
+ if (!needs_legacy_probe && (ret || card->instantiated))
clean_card_reference(card);
if (ret) {