]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: codecs: tas675x: use READ_ONCE for params to be used concurrently
authorSen Wang <sen@ti.com>
Tue, 30 Jun 2026 18:31:20 +0000 (13:31 -0500)
committerMark Brown <broonie@kernel.org>
Wed, 1 Jul 2026 18:52:36 +0000 (19:52 +0100)
active_playback_dais and active_capture_dais are written atomically via
set_bit()/clear_bit() and can be read concurrently from the
fault_check_work delayed work handler.

fault_check_work already uses READ_ONCE; extend the same guard to all other
reads in tas675x_hw_params() and tas675x_mute_stream().

Fixes: 133c81f84471 ("ASoC: codecs: Add TAS67524 quad-channel audio amplifier driver")
Signed-off-by: Sen Wang <sen@ti.com>
Link: https://patch.msgid.link/20260630183126.2588322-2-sen@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/tas675x.c

index 6f89a422f3c62a1f4ca33126d1b48090ec4da03c..f1d2bbc8500810a1cbb6b6bc43ab2a3b8f4f58cf 100644 (file)
@@ -1133,7 +1133,7 @@ static int tas675x_hw_params(struct snd_pcm_substream *substream,
         * Single clock domain: SDIN and SDOUT share one SCLK/FSYNC pair,
         * so all active DAIs must use the same sample rate.
         */
-       if ((tas->active_playback_dais || tas->active_capture_dais) &&
+       if ((READ_ONCE(tas->active_playback_dais) || READ_ONCE(tas->active_capture_dais)) &&
            tas->rate && tas->rate != rate) {
                dev_err(component->dev,
                        "Rate %u conflicts with active rate %u\n",
@@ -1397,14 +1397,14 @@ static int tas675x_mute_stream(struct snd_soc_dai *dai, int mute, int direction)
                set_bit(dai->id, &tas->active_playback_dais);
 
        /* Last playback stream */
-       if (mute && !tas->active_playback_dais) {
+       if (mute && !READ_ONCE(tas->active_playback_dais)) {
                ret = tas675x_set_state_all(tas, TAS675X_STATE_SLEEP_BOTH);
                regmap_read(tas->regmap, TAS675X_CLK_FAULT_LATCHED_REG, &discard);
                return ret;
        }
 
        return tas675x_set_state_all(tas,
-                                    tas->active_playback_dais ?
+                                    READ_ONCE(tas->active_playback_dais) ?
                                        TAS675X_STATE_PLAY_BOTH :
                                        TAS675X_STATE_SLEEP_BOTH);
 }