ASoC: codecs: propagate sdw_write() errors from bus_config callbacks
Subsystems (4)
cover ASoC: codecs: propagate sdw_write() errors from bus_config callbacks
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().
Resending the series unchanged, only rebased onto current mainline. The original posting got no response, probably because it went out right before the v7.4 merge window:
https://lore.kernel.org/all/[email protected]/
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: 20eef29b7c8465ac98d7dd6d6f2ac07a8d8056ca
Signature · 1 line
2.56.1
PATCH RESEND 1/2 ASoC: codecs: wsa881x: propagate sdw_write() error from bus_config
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.
--- sound/soc/codecs/wsa881x.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
sound/soc/codecs/wsa881x.c +2 -4
@@ -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 = {
Signature · 1 line
2.56.1
PATCH RESEND 2/2 ASoC: codecs: wcd-common: propagate sdw_write() error from bus_config
In reply to Andrey Karelinwcd_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.
--- sound/soc/codecs/wcd-common.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/wcd-common.c +1 -3
@@ -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);
Signature · 1 line
2.56.1
Hi Srinivas,
Gentle ping on this series. It was first posted on 16 Oct and resent unchanged on 18 Nov; there have been no comments so far.
The change is small: wsa881x_bus_config() and wcd_bus_config() return the result of sdw_write() instead of always returning 0, as the other SoundWire codec drivers already do. Both patches still apply to broonie/sound for-7.5, including on top of "ASoC: codecs: wcd-common:
bound interrupt status retries".
Could you take a look and let me know if you have any concerns, or ack the series if it looks fine to you?
Thanks,
Andrey