Skip to contentSkip to conversation

ASoC: Intel: sof_wm8804: add check for CLKDIV setting

PATCH New Vitaliy Shevtsov 1 participant 1 message Nov 6, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: Intel: sof_wm8804: add check for CLKDIV setting

Currently the return value of snd_soc_dai_set_clkdiv() is not checked for a possible failure. Despite it cannot fail as long as the second argument is either WM8804_CLKOUT_DIV or WM8804_MCLK_DIV because wm8804_set_clkdiv() handles both of them it is still better to add this check for the sake of completeness and correctness. Also this is the only snd_soc_dai_set_clkdiv() call site where the return value is not processed.

Found by Linux Verification Center (linuxtesting.org) with Svace.

---
 sound/soc/intel/boards/sof_wm8804.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
sound/soc/intel/boards/sof_wm8804.c +6 -1
index facc6c32cbfe..d7ac54e9d0a8 100644
@@ -123,7 +123,12 @@ static int sof_wm8804_hw_params(struct snd_pcm_substream *substream,
 		}
 	}
 
-	snd_soc_dai_set_clkdiv(codec_dai, WM8804_MCLK_DIV, mclk_div);
+	ret = snd_soc_dai_set_clkdiv(codec_dai, WM8804_MCLK_DIV, mclk_div);
+	if (ret < 0) {
+		dev_err(rtd->card->dev, "Failed to set WM8804 CLKDIV\n");
+		return ret;
+	}
+
 	ret = snd_soc_dai_set_pll(codec_dai, 0, 0, sysclk, mclk_freq);
 	if (ret < 0) {
 		dev_err(rtd->card->dev, "Failed to set WM8804 PLL\n");
Signature · 1 line
2.46.2