* [PATCH 0/2] ASoC: codecs: propagate sdw_write() errors from bus_config callbacks
@ 2026-10-16 14:33 Andrey Karelin
2026-10-16 14:33 ` [PATCH 1/2] ASoC: codecs: wsa881x: propagate sdw_write() error from bus_config Andrey Karelin
2026-10-16 14:33 ` [PATCH 2/2] ASoC: codecs: wcd-common: " Andrey Karelin
0 siblings, 2 replies; 3+ messages in thread
From: Andrey Karelin @ 2026-10-16 14:33 UTC (permalink / raw)
To: Srinivas Kandagatla, Mark Brown
Cc: Andrey Karelin, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
Pierre-Louis Bossart, Neil Armstrong, linux-sound, linux-arm-msm,
linux-kernel, lvc-project
wsa881x_bus_config() and wcd_bus_config() (shared by the WCD938x and
WCD939x SoundWire drivers) program the clock divider for the next bank
with sdw_write() but ignore its result and always return 0, so a failed
write is never reported to sdw_notify_config(). The other SoundWire
codec drivers that implement bus_config already return the error.
Both patches simply return the result of sdw_write().
Andrey Karelin (2):
ASoC: codecs: wsa881x: propagate sdw_write() error from bus_config
ASoC: codecs: wcd-common: propagate sdw_write() error from bus_config
sound/soc/codecs/wcd-common.c | 4 +---
sound/soc/codecs/wsa881x.c | 6 ++----
2 files changed, 3 insertions(+), 7 deletions(-)
base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
--
2.56.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] ASoC: codecs: wsa881x: propagate sdw_write() error from bus_config
2026-10-16 14:33 [PATCH 0/2] ASoC: codecs: propagate sdw_write() errors from bus_config callbacks Andrey Karelin
@ 2026-10-16 14:33 ` Andrey Karelin
2026-10-16 14:33 ` [PATCH 2/2] ASoC: codecs: wcd-common: " Andrey Karelin
1 sibling, 0 replies; 3+ messages in thread
From: Andrey Karelin @ 2026-10-16 14:33 UTC (permalink / raw)
To: Srinivas Kandagatla, Mark Brown
Cc: Andrey Karelin, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
Pierre-Louis Bossart, Neil Armstrong, linux-sound, linux-arm-msm,
linux-kernel, lvc-project
wsa881x_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
amplifier may keep running with a wrong clock configuration after the
bank switch.
Return the result of sdw_write() instead.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: a0aab9e1404a ("ASoC: codecs: add wsa881x amplifier support")
Signed-off-by: Andrey Karelin <a.karelin@ideco.ru>
---
sound/soc/codecs/wsa881x.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/wsa881x.c b/sound/soc/codecs/wsa881x.c
index 47ac3e4985a5..0fc7132c0a9c 100644
--- a/sound/soc/codecs/wsa881x.c
+++ b/sound/soc/codecs/wsa881x.c
@@ -1093,10 +1093,8 @@ static int wsa881x_port_prep(struct sdw_slave *slave,
static int wsa881x_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);
}
static const struct sdw_slave_ops wsa881x_slave_ops = {
--
2.56.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] ASoC: codecs: wcd-common: propagate sdw_write() error from bus_config
2026-10-16 14:33 [PATCH 0/2] ASoC: codecs: propagate sdw_write() errors from bus_config callbacks Andrey Karelin
2026-10-16 14:33 ` [PATCH 1/2] ASoC: codecs: wsa881x: propagate sdw_write() error from bus_config Andrey Karelin
@ 2026-10-16 14:33 ` Andrey Karelin
1 sibling, 0 replies; 3+ messages in thread
From: Andrey Karelin @ 2026-10-16 14:33 UTC (permalink / raw)
To: Srinivas Kandagatla, Mark Brown
Cc: Andrey Karelin, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
Pierre-Louis Bossart, Neil Armstrong, linux-sound, linux-arm-msm,
linux-kernel, lvc-project
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@ideco.ru>
---
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-16 15:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-16 14:33 [PATCH 0/2] ASoC: codecs: propagate sdw_write() errors from bus_config callbacks Andrey Karelin
2026-10-16 14:33 ` [PATCH 1/2] ASoC: codecs: wsa881x: propagate sdw_write() error from bus_config Andrey Karelin
2026-10-16 14:33 ` [PATCH 2/2] ASoC: codecs: wcd-common: " Andrey Karelin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®