* [PATCH] ASoC: ssm2518: Fix off-by-one error by ffs()
@ 2013-12-23 10:42 Takashi Iwai
2014-01-01 15:42 ` Lars-Peter Clausen
2014-01-02 11:54 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Takashi Iwai @ 2013-12-23 10:42 UTC (permalink / raw)
To: Lars-Peter Clausen; +Cc: alsa-devel, Mark Brown, Liam Girdwood
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>
---
I found it casully while checking ab8500 bug.
The patch is untested, so please review/test first, and give Cc to
stable if needed.
sound/soc/codecs/ssm2518.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/ssm2518.c b/sound/soc/codecs/ssm2518.c
index 95aed552139a..cc8debce752f 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);
}
}
--
1.8.5.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: ssm2518: Fix off-by-one error by ffs()
2013-12-23 10:42 [PATCH] ASoC: ssm2518: Fix off-by-one error by ffs() Takashi Iwai
@ 2014-01-01 15:42 ` Lars-Peter Clausen
2014-01-02 11:54 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Lars-Peter Clausen @ 2014-01-01 15:42 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel, Mark Brown, Liam Girdwood
On 12/23/2013 11:42 AM, Takashi Iwai wrote:
> 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>
Looks good, thanks.
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: ssm2518: Fix off-by-one error by ffs()
2013-12-23 10:42 [PATCH] ASoC: ssm2518: Fix off-by-one error by ffs() Takashi Iwai
2014-01-01 15:42 ` Lars-Peter Clausen
@ 2014-01-02 11:54 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2014-01-02 11:54 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel, Lars-Peter Clausen, Liam Girdwood
[-- Attachment #1.1: Type: text/plain, Size: 288 bytes --]
On Mon, Dec 23, 2013 at 11:42:55AM +0100, Takashi Iwai wrote:
> 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.
Applied, thanks.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-01-02 11:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-23 10:42 [PATCH] ASoC: ssm2518: Fix off-by-one error by ffs() Takashi Iwai
2014-01-01 15:42 ` Lars-Peter Clausen
2014-01-02 11:54 ` Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.