mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vitaliy Shevtsov <v.shevtsov@maxima.ru>
To: Cezary Rojewski <cezary.rojewski@intel.com>
Cc: "Vitaliy Shevtsov" <v.shevtsov@maxima.ru>,
	"Liam Girdwood" <liam.r.girdwood@linux.intel.com>,
	"Peter Ujfalusi" <peter.ujfalusi@linux.intel.com>,
	"Bard Liao" <yung-chuan.liao@linux.intel.com>,
	"Ranjani Sridharan" <ranjani.sridharan@linux.intel.com>,
	"Kai Vehmanen" <kai.vehmanen@linux.intel.com>,
	"Pierre-Louis Bossart" <pierre-louis.bossart@linux.dev>,
	"Mark Brown" <broonie@kernel.org>,
	"Jaroslav Kysela" <perex@perex.cz>,
	"Takashi Iwai" <tiwai@suse.com>,
	"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
	"Christophe JAILLET" <christophe.jaillet@wanadoo.fr>,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	lvc-project@linuxtesting.org
Subject: [PATCH] ASoC: Intel: sof_wm8804: add check for CLKDIV setting
Date: Wed, 6 Nov 2024 14:06:02 +0000	[thread overview]
Message-ID: <20241106140603.14516-2-v.shevtsov@maxima.ru> (raw)

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.

Signed-off-by: Vitaliy Shevtsov <v.shevtsov@maxima.ru>
---
 sound/soc/intel/boards/sof_wm8804.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sound/soc/intel/boards/sof_wm8804.c b/sound/soc/intel/boards/sof_wm8804.c
index facc6c32cbfe..d7ac54e9d0a8 100644
--- a/sound/soc/intel/boards/sof_wm8804.c
+++ b/sound/soc/intel/boards/sof_wm8804.c
@@ -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");
-- 
2.46.2


                 reply	other threads:[~2024-11-06  9:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241106140603.14516-2-v.shevtsov@maxima.ru \
    --to=v.shevtsov@maxima.ru \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=perex@perex.cz \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.dev \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=tiwai@suse.com \
    --cc=u.kleine-koenig@baylibre.com \
    --cc=yung-chuan.liao@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®