[PATCH 2/3] ASoC: stm32: spdifrx: Fix refcount on sync failure
phucduc.bui at gmail.com
phucduc.bui at gmail.com
Fri Nov 27 01:23:44 PST 2026
From: bui duc phuc <phucduc.bui at gmail.com>
Roll back the refcount when starting synchronization fails.
Disable interrupts if no users remain.
Signed-off-by: bui duc phuc <phucduc.bui at gmail.com>
---
sound/soc/stm/stm32_spdifrx.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/sound/soc/stm/stm32_spdifrx.c b/sound/soc/stm/stm32_spdifrx.c
index 467c3c583a00..ba6c715750aa 100644
--- a/sound/soc/stm/stm32_spdifrx.c
+++ b/sound/soc/stm/stm32_spdifrx.c
@@ -358,9 +358,15 @@ static int stm32_spdifrx_start_sync(struct stm32_spdifrx_data *spdifrx)
cr_mask |= SPDIFRX_CR_SPDIFEN_MASK;
ret = regmap_update_bits(spdifrx->regmap, STM32_SPDIFRX_CR,
cr_mask, cr);
- if (ret < 0)
+ if (ret < 0) {
dev_err(&spdifrx->pdev->dev,
"Failed to start synchronization\n");
+ spdifrx->refcount--;
+ if (!spdifrx->refcount)
+ regmap_update_bits(spdifrx->regmap,
+ STM32_SPDIFRX_IMR,
+ SPDIFRX_XIMR_MASK, 0);
+ }
}
return ret;
--
2.43.0
More information about the linux-arm-kernel
mailing list