[PATCH 2/2] ASoC: codecs: wcd-common: propagate sdw_write() error from bus_config
From: Andrey Karelin
Date: Fri Oct 16 2026 - 11:40:21 EST
wcd_bus_config() programs the clock divider for the next bank via
sdw_write() but ignores its result and always returns 0. A failed write
is therefore hidden from sdw_notify_config(), which aborts programming
of the stream parameters when a bus_config callback fails, and the
codec may keep running with a wrong clock configuration after the bank
switch.
The callback is shared by the WCD938x and WCD939x SoundWire drivers.
It was moved to the common helper as is by commit 59aebbbb0b47 ("ASoC:
codecs: wcd-common: move status_update callback to common"); the
original per-driver callbacks had the same problem.
Return the result of sdw_write() instead.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 16572522aece ("ASoC: codecs: wcd938x-sdw: add SoundWire driver")
Fixes: be2af391cea0 ("ASoC: codecs: Add WCD939x Soundwire devices driver")
Signed-off-by: Andrey Karelin <a.karelin@xxxxxxxx>
---
sound/soc/codecs/wcd-common.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/sound/soc/codecs/wcd-common.c b/sound/soc/codecs/wcd-common.c
index 9016e974582f..74bd718b8a34 100644
--- a/sound/soc/codecs/wcd-common.c
+++ b/sound/soc/codecs/wcd-common.c
@@ -115,9 +115,7 @@ EXPORT_SYMBOL_GPL(wcd_update_status);
int wcd_bus_config(struct sdw_slave *slave, struct sdw_bus_params *params)
{
- sdw_write(slave, SWRS_SCP_HOST_CLK_DIV2_CTL_BANK(params->next_bank), 0x01);
-
- return 0;
+ return sdw_write(slave, SWRS_SCP_HOST_CLK_DIV2_CTL_BANK(params->next_bank), 0x01);
}
EXPORT_SYMBOL_GPL(wcd_bus_config);
--
2.56.0