diff mbox series

[04/10] ASoC: wm8903: remove useless assignments

Message ID 20210311004332.120901-5-pierre-louis.bossart@linux.intel.com
State Accepted
Commit 13119a311aeb5a91ea751f10e4158a86361c2f08
Headers show
Series ASoC: codecs: wolfson: remove cppcheck warnings | expand

Commit Message

Pierre-Louis Bossart March 11, 2021, 12:43 a.m. UTC
cppcheck warnings:

sound/soc/codecs/wm8903.c:1552:11: style: Variable 'best_val' is
assigned a value that is never used. [unreadVariable]
 best_val = ((clk_sys * 10) / bclk_divs[0].ratio) - bclk;
          ^
sound/soc/codecs/wm8903.c:1559:12: style: Variable 'best_val' is
assigned a value that is never used. [unreadVariable]
  best_val = cur_val;
           ^

Indeed what matters in the code is the blck_div, the best_val is
assigned but never tested or used.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/wm8903.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Charles Keepax March 11, 2021, 9:25 a.m. UTC | #1
On Wed, Mar 10, 2021 at 06:43:26PM -0600, Pierre-Louis Bossart wrote:
> cppcheck warnings:
> 
> sound/soc/codecs/wm8903.c:1552:11: style: Variable 'best_val' is
> assigned a value that is never used. [unreadVariable]
>  best_val = ((clk_sys * 10) / bclk_divs[0].ratio) - bclk;
>           ^
> sound/soc/codecs/wm8903.c:1559:12: style: Variable 'best_val' is
> assigned a value that is never used. [unreadVariable]
>   best_val = cur_val;
>            ^
> 
> Indeed what matters in the code is the blck_div, the best_val is
> assigned but never tested or used.
> 
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles
diff mbox series

Patch

diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c
index 026603ae44ce..75f30154c809 100644
--- a/sound/soc/codecs/wm8903.c
+++ b/sound/soc/codecs/wm8903.c
@@ -1549,14 +1549,12 @@  static int wm8903_hw_params(struct snd_pcm_substream *substream,
 	 * BCLKs to clock out the samples).
 	 */
 	bclk_div = 0;
-	best_val = ((clk_sys * 10) / bclk_divs[0].ratio) - bclk;
 	i = 1;
 	while (i < ARRAY_SIZE(bclk_divs)) {
 		cur_val = ((clk_sys * 10) / bclk_divs[i].ratio) - bclk;
 		if (cur_val < 0) /* BCLK table is sorted */
 			break;
 		bclk_div = i;
-		best_val = cur_val;
 		i++;
 	}