]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ASoC: sdw_utils: return -EPROBE_DEFER if components are not registered yet
authorBard Liao <yung-chuan.liao@linux.intel.com>
Fri, 29 May 2026 01:42:59 +0000 (09:42 +0800)
committerMark Brown <broonie@kernel.org>
Fri, 29 May 2026 14:41:51 +0000 (15:41 +0100)
commit 42d99857d6f0 ("ASoC: core: Move all users to deferrable card binding")
converted the -EPROBE_DEFER return value of snd_soc_bind_card() to 0
which results in the machine driver probe return 0 and will not be
called again when any component is not yet registered.
We get the right component name from the registered components
and use it in the dai links. It will lead to bind fail if the default
component name is used. Return -EPROBE_DEFER to allow the machine driver
probe again after the components are registered.

Suggested-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20260529014259.2528048-1-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sdw_utils/soc_sdw_utils.c

index 9d0768f21ba4c7e71523838a0ca5f1c0bda47f06..681452bb89f2b746b7567ae325711734cfa35d5d 100644 (file)
@@ -1629,7 +1629,9 @@ const char *asoc_sdw_get_codec_name(struct device *dev,
                                __func__, component->name, dai_info->codec_name);
                        return devm_kstrdup(dev, component->name, GFP_KERNEL);
                } else {
-                       return devm_kstrdup(dev, dai_info->codec_name, GFP_KERNEL);
+                       dev_dbg(dev, "%s component %s is not registered yet\n",
+                               __func__, dai_info->codec_name);
+                       return ERR_PTR(-EPROBE_DEFER);
                }
        }
 
@@ -2021,7 +2023,9 @@ int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card,
                                                codec_info->auxs[j].codec_name);
                                        soc_aux->dlc.name = component->name;
                                } else {
-                                       soc_aux->dlc.name = codec_info->auxs[j].codec_name;
+                                       dev_dbg(dev, "%s the aux component %s is not registered yet\n",
+                                               __func__, codec_info->auxs[j].codec_name);
+                                       return -EPROBE_DEFER;
                                }
                                soc_aux++;
                        }
@@ -2121,6 +2125,8 @@ int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card,
 
                                codec_name = asoc_sdw_get_codec_name(dev, dai_info,
                                                                     adr_link, i);
+                               if (IS_ERR(codec_name))
+                                       return PTR_ERR(codec_name);
                                if (!codec_name)
                                        return -ENOMEM;