diff mbox series

ASoC: soc-dai.c: add missing flag check at snd_soc_pcm_dai_probe()

Message ID 87wn3u64e6.wl-kuninori.morimoto.gx@renesas.com (mailing list archive)
State Superseded
Headers show
Series ASoC: soc-dai.c: add missing flag check at snd_soc_pcm_dai_probe() | expand

Commit Message

Kuninori Morimoto March 6, 2023, 1:43 a.m. UTC
dai->probed is used at snd_soc_pcm_dai_probe/remove(),
and used to call real remove() function only when it was probed.

	int snd_soc_pcm_dai_probe(...)
	{
		...
		for_each_rtd_dais(rtd, i, dai) {
			...

			if (dai->driver->probe) {
(A)				int ret = dai->driver->probe(dai);

				if (ret < 0)
					return soc_dai_ret(dai, ret);
			}

=>			dai->probed = 1;
		}
		...
	}

	int snd_soc_pcm_dai_remove(...)
	{
		...
		for_each_rtd_dais(rtd, i, dai) {
			...
=>			if (dai->probed &&
			    ...) {
				...
			}

=>			dai->probed = 0;
		}
		...
	}

But on probe() case, we need to check dai->probed before calling
real probe() function at (A), otherwise real probe() might be called
multi times (but real remove() will be called only once).
This patch checks it at probe().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-dai.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Mark Brown March 15, 2023, 1:19 p.m. UTC | #1
On Mon, 06 Mar 2023 01:43:30 +0000, Kuninori Morimoto wrote:
> dai->probed is used at snd_soc_pcm_dai_probe/remove(),
> and used to call real remove() function only when it was probed.
> 
> 	int snd_soc_pcm_dai_probe(...)
> 	{
> 		...
> 		for_each_rtd_dais(rtd, i, dai) {
> 			...
> 
> [...]

Applied to

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

Thanks!

[1/1] ASoC: soc-dai.c: add missing flag check at snd_soc_pcm_dai_probe()
      commit: 5c5a7521e9364a40fe2c1b67ab79991e3e9085df

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
diff mbox series

Patch

diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c
index 0119afbd01fc..02dd64dea179 100644
--- a/sound/soc/soc-dai.c
+++ b/sound/soc/soc-dai.c
@@ -542,6 +542,9 @@  int snd_soc_pcm_dai_probe(struct snd_soc_pcm_runtime *rtd, int order)
 		if (dai->driver->probe_order != order)
 			continue;
 
+		if (dai->probed)
+			continue;
+
 		if (dai->driver->probe) {
 			int ret = dai->driver->probe(dai);