Skip to contentSkip to conversation

ASoC: stm32: spdifrx: fix synchronization state check

PATCH In review Avi Weiss 3 participants 3 messages Oct 11 – Oct 12

Subsystems (4)
lore
Share & tools
lore

Avi Weiss

author
#0 lore raw

PATCH 1/1 ASoC: stm32: spdifrx: fix synchronization state check

The interrupt handler uses a logical AND to check whether SPDIFRX was in the SYNC state before clearing errors. Since both SYNC (1) and ENABLE (3) are nonzero, this also treats ENABLE as SYNC (and any other non-zero value that might be added).

The logical && basically just converts this to check for != 0.

So errors occurring while SPDIFRX is enabled cause the driver to retry synch instead of disconnecting the PCM stream.

Fix is to change the logical && to equality (==) and only retry when exactly in sync state.

Fixes 0c93c291321f2 ("ASoC: stm32: spdifrx: retry synchronization in sync state")
---
 sound/soc/stm/stm32_spdifrx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/stm/stm32_spdifrx.c +1 -1
index 0ece547407739..88863dbd05d9b 100644
@@ -720,7 +720,7 @@ static irqreturn_t stm32_spdifrx_isr(int irq, void *devid)
 
 	if (err) {
 		regmap_read(spdifrx->regmap, STM32_SPDIFRX_CR, &cr);
-		sync_state = FIELD_GET(SPDIFRX_CR_SPDIFEN_MASK, cr) &&
+		sync_state = FIELD_GET(SPDIFRX_CR_SPDIFEN_MASK, cr) ==
 			     SPDIFRX_SPDIFEN_SYNC;
 
 		/* SPDIFRX is in STATE_STOP. Disable SPDIFRX to clear errors */

base-commit: 611680f6050a66b84e5cc0af33862a83d1f7a200

Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi Avi,

Quoted 33 lines · Avi Weiss

The interrupt handler uses a logical AND to check whether SPDIFRX was in the SYNC state before clearing errors. Since both SYNC (1) and ENABLE (3) are nonzero, this also treats ENABLE as SYNC (and any other non-zero value that might be added).

The logical && basically just converts this to check for != 0.

So errors occurring while SPDIFRX is enabled cause the driver to retry synch instead of disconnecting the PCM stream.

Fix is to change the logical && to equality (==) and only retry when exactly in sync state.

Fixes 0c93c291321f2 ("ASoC: stm32: spdifrx: retry synchronization in sync state")
---
  sound/soc/stm/stm32_spdifrx.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/stm/stm32_spdifrx.c +1 -1
index 0ece547407739..88863dbd05d9b 100644
@@ -720,7 +720,7 @@ static irqreturn_t stm32_spdifrx_isr(int irq, void *devid)
 
  	if (err) {
  		regmap_read(spdifrx->regmap, STM32_SPDIFRX_CR, &cr);
-		sync_state = FIELD_GET(SPDIFRX_CR_SPDIFEN_MASK, cr) &&
+		sync_state = FIELD_GET(SPDIFRX_CR_SPDIFEN_MASK, cr) ==
  			     SPDIFRX_SPDIFEN_SYNC;
 
  		/* SPDIFRX is in STATE_STOP. Disable SPDIFRX to clear errors */
Quoted 1 line

base-commit: 611680f6050a66b84e5cc0af33862a83d1f7a200

Thanks
Olivier

maintainer
#2 lore raw
In reply to Avi Weiss
Quoted 1 line · Avi Weiss

ASoC: stm32: spdifrx: fix synchronization state check

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.3

Thanks!

[1/1] ASoC: stm32: spdifrx: fix synchronization state check

      https://git.kernel.org/broonie/misc/c/0936bbd35a24

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark