summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-12-23 11:42:55 +0100
committerMark Brown <broonie@linaro.org>2014-01-02 11:54:15 +0000
commitf60e5473e6788f93849a61198bec4e02fea31e51 (patch)
treecf211455da24d174f6187dd4a6d40ef24925ad36 /sound
parent6ce4eac1f600b34f2f7f58f9cd8f0503d79e42ae (diff)
ASoC: ssm2518: Fix off-by-one error by ffs()
ffs() returns the bit position from 1, while the ssm2158 driver code assumes it being 0-based. Also, the bit mask computation of the two channel slots are incorrect; it must have worked just casually. Signed-off-by: Takashi Iwai <tiwai@suse.de> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/ssm2518.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sound/soc/codecs/ssm2518.c b/sound/soc/codecs/ssm2518.c
index 95aed552139..cc8debce752 100644
--- a/sound/soc/codecs/ssm2518.c
+++ b/sound/soc/codecs/ssm2518.c
@@ -549,13 +549,13 @@ static int ssm2518_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
right_slot = 0;
} else {
/* We assume the left channel < right channel */
- left_slot = ffs(tx_mask);
- tx_mask &= ~(1 << tx_mask);
+ left_slot = __ffs(tx_mask);
+ tx_mask &= ~(1 << left_slot);
if (tx_mask == 0) {
right_slot = left_slot;
} else {
- right_slot = ffs(tx_mask);
- tx_mask &= ~(1 << tx_mask);
+ right_slot = __ffs(tx_mask);
+ tx_mask &= ~(1 << right_slot);
}
}