Skip to content

Commit

Permalink
ASoC: fix oops w/ for_each_rtd_codec_dai_rollback() macro
Browse files Browse the repository at this point in the history
A kernel oops happens on an error case (usual missing BE mixer
configuration required by Intel SST driver). Git bisect points to this
macro and an operator precedence issue.

	for (; ((i--) >= 0) && ((dai) = rtd->codec_dais[i]);)

The initial code replaced by this macro was
	while (--i >= 0) {
		codec_dai = rtd->codec_dais[i];

Fix the C operator precedence difference by reverting to pre-decrement

Fixes: 0b7990e ('ASoC: add for_each_rtd_codec_dai() macro')
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Pierre-Louis Bossart authored and Mark Brown committed Oct 30, 2018
1 parent 409fa67 commit 23cb2d0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/sound/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ struct snd_soc_pcm_runtime {
((i) < rtd->num_codecs) && ((dai) = rtd->codec_dais[i]); \
(i)++)
#define for_each_rtd_codec_dai_rollback(rtd, i, dai) \
for (; ((i--) >= 0) && ((dai) = rtd->codec_dais[i]);)
for (; ((--i) >= 0) && ((dai) = rtd->codec_dais[i]);)


/* mixer control */
Expand Down

0 comments on commit 23cb2d0

Please sign in to comment.