]> git.baikalelectronics.ru Git - kernel.git/commit
ASoC: rockchip: i2s-tdm: Fix refcount test
authorNicolas Frattaroli <frattaroli.nicolas@gmail.com>
Fri, 15 Oct 2021 21:07:29 +0000 (23:07 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 18 Oct 2021 12:56:44 +0000 (13:56 +0100)
commit2c6c23148a186c2d2563d0ae535340843371b078
treea0baa16f9ba10307b3296cc9fb95dfe52358bfd4
parente77acc31a80a4230adea5f91cd4ecbf5bf618415
ASoC: rockchip: i2s-tdm: Fix refcount test

During development of V5 of the i2s-tdm patch series, I replaced
the atomic refcount with a regular integer, as it was only ever
accessed within a spinlock.

Foolishly, I got the semantics of atomic_dec_and_test wrong, which
resulted in a test for 0 actually becoming a test for >0.

The result was that setting the audio frequency broke; switching
from 44100 Hz audio playback to 96000 Hz audio playback would
garble the sound most unpleasantly.

Fix this by checking for --refcount == 0, which is what it should
have been all along.

Fixes: 5bf175e1d496 ("ASoC: rockchip: add support for i2s-tdm controller")
Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
Link: https://lore.kernel.org/r/20211015210730.308946-1-frattaroli.nicolas@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/rockchip/rockchip_i2s_tdm.c