[PATCH AUTOSEL 6.19] ASoC: sdw_utils: remove dai registered check

Sasha Levin
2026-02-14T01:03:32Z

From: Bard Liao <yung-chuan.liao@linux.intel.com>

[ Upstream commit 8d38c275f7ffe257d21bea224d4288eef183817d ]

Checking for a registered DAI for non-existing endpoints causes the
following error. The driver will always return -EPROBE_DEFER if the
codec driver doesn't register the DAI of the unexist endpoint.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20260120065658.1806027-1-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

## Analysis of ASoC: sdw_utils: remove dai registered check

### Commit Message Analysis

The commit message describes a bug where checking for a registered DAI
for **non-existing endpoints** causes the driver to always return
`-EPROBE_DEFER` if the codec driver doesn't register the DAI of a non-
existent endpoint. This means the system enters an infinite probe
deferral loop — the device will never successfully probe because it's
waiting for a DAI that will never be registered (since the endpoint
doesn't exist).

### Code Change Analysis

The change removes a block of code from `is_sdca_endpoint_present()`
that:

1. Allocated a `snd_soc_dai_link_component` (dlc)
2. Looked up the DAI name from `dai_info`
3. Called `snd_soc_find_dai_with_mutex()` to check if the codec DAI was
registered
4. If not found, returned `-EPROBE_DEFER`
5. Freed the dlc

**The bug mechanism:** The function `is_sdca_endpoint_present()` is
supposed to determine if an endpoint is present (returns 1) or not
(returns 0). However, for endpoints that don't actually exist on the
hardware, the codec driver will never register their DAIs. The removed
code would find that the DAI isn't registered and return
`-EPROBE_DEFER`, causing the probe to be deferred indefinitely. This
creates an infinite deferral loop — the system keeps retrying probe but
the DAI will never appear because the endpoint doesn't exist.

The rest of the function (which remains) properly handles endpoint
presence detection by checking the SoundWire slave's SDCA data and
function properties — this is the correct way to determine if an
endpoint is present.

### Classification

This is a **bug fix** — it fixes a probe failure (infinite
`-EPROBE_DEFER` loop) that prevents SoundWire audio devices from
initializing properly. Users with affected hardware would have no audio
functionality.

### Scope and Risk Assessment

- **Lines changed:** Removes ~15 lines of code (the DAI registration
check and associated allocation/free)
- **Files touched:** 1 file (`sound/soc/sdw_utils/soc_sdw_utils.c`)
- **Risk:** LOW — the code being removed was performing an unnecessary
check that was actively harmful. The remaining code in the function is
the correct logic for determining endpoint presence.
- **Side effects:** The removal also eliminates a memory allocation
(`kzalloc`/`kfree`) making the function simpler and more efficient.

### User Impact

- **Who is affected:** Users with SoundWire-based audio hardware (Intel
platforms with SoundWire codecs, which is increasingly common in
modern laptops)
- **Severity:** HIGH — Without this fix, affected systems have
completely non-functional audio because the probe never completes
- **Trigger:** The bug triggers whenever the ACPI tables describe
endpoints that don't physically exist on the hardware, which can
happen in normal configurations

### Stability Indicators

- **Reviewed-by:** Three reviewers (Péter Ujfalusi, Liam Girdwood,
Charles Keepax) — all well-known ASoC developers
- **Author:** Bard Liao (Intel SoundWire maintainer) — deeply familiar
with this subsystem
- **Applied by:** Mark Brown (ASoC maintainer)

### Dependency Check

The change is self-contained — it only removes code, so there are no
forward dependencies. The function and surrounding code should exist in
recent stable trees that include SoundWire SDCA support.

### Conclusion

This is a clear bug fix that resolves an infinite probe deferral loop
for SoundWire audio devices. The fix is small (pure code removal), well-
reviewed by multiple subsystem experts, low risk, and addresses a real
user-visible issue (no audio on affected hardware). It meets all stable
kernel criteria: obviously correct, fixes a real bug, small and
contained, no new features.

**YES**

sound/soc/sdw_utils/soc_sdw_utils.c | 15 ---------------
1 file changed, 15 deletions(-)

diff --git a/sound/soc/sdw_utils/soc_sdw_utils.c b/sound/soc/sdw_utils/soc_sdw_utils.c
index ccf149f949e8f..d03072cd13cb9 100644
--- a/sound/soc/sdw_utils/soc_sdw_utils.c
+++ b/sound/soc/sdw_utils/soc_sdw_utils.c
@@ -1421,29 +1421,14 @@ static int is_sdca_endpoint_present(struct device *dev,
const struct snd_soc_acpi_adr_device *adr_dev = &adr_link->adr_d[adr_index];
const struct snd_soc_acpi_endpoint *adr_end;
const struct asoc_sdw_dai_info *dai_info;
- struct snd_soc_dai_link_component *dlc;
- struct snd_soc_dai *codec_dai;
struct sdw_slave *slave;
struct device *sdw_dev;
const char *sdw_codec_name;
int ret, i;

- dlc = kzalloc(sizeof(*dlc), GFP_KERNEL);
- if (!dlc)
- return -ENOMEM;
-
adr_end = &adr_dev->endpoints[end_index];
dai_info = &codec_info->dais[adr_end->num];

- dlc->dai_name = dai_info->dai_name;
- codec_dai = snd_soc_find_dai_with_mutex(dlc);
- if (!codec_dai) {
- dev_warn(dev, "codec dai %s not registered yet\n", dlc->dai_name);
- kfree(dlc);
- return -EPROBE_DEFER;
- }
- kfree(dlc);
-
sdw_codec_name = _asoc_sdw_get_codec_name(dev, adr_link, adr_index);
if (!sdw_codec_name)
return -ENOMEM;
--
2.51.0