diff mbox

ASoC: rsnd: fixup dai remove callback operation

Message ID 87lhrj9m26.wl%kuninori.morimoto.gx@gmail.com (mailing list archive)
State Accepted
Commit d62a3dcd4d75b1713d12697afdbffaf9a9da8f43
Headers show

Commit Message

Kuninori Morimoto July 24, 2014, 8:51 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

rsnd driver is using SSI/SRC/DVC which are
using "mod" base operation.
These "mod" are supporting "probe" and "remove" callbacks.

Current rsnd_probe should call "remove" if "probe" was failed,
since "probe" might be having DMAEngine handle.
Some mod's "remove" callback might be called without calling
"probe", but it is no problem. because "remove" do nothing
in such case.

So, all mod's "remove" should be called when error case
of rsnd_probe() and rsnd_remove().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/core.c |   22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

Comments

Mark Brown July 25, 2014, 5:50 p.m. UTC | #1
On Thu, Jul 24, 2014 at 01:51:31AM -0700, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> rsnd driver is using SSI/SRC/DVC which are
> using "mod" base operation.
> These "mod" are supporting "probe" and "remove" callbacks.

Applied, thanks.
diff mbox

Patch

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 907d480..1b4d8700 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -1041,11 +1041,11 @@  static int rsnd_probe(struct platform_device *pdev)
 	for_each_rsnd_dai(rdai, priv, i) {
 		ret = rsnd_dai_call(probe, &rdai->playback, rdai);
 		if (ret)
-			return ret;
+			goto exit_snd_probe;
 
 		ret = rsnd_dai_call(probe, &rdai->capture, rdai);
 		if (ret)
-			return ret;
+			goto exit_snd_probe;
 	}
 
 	/*
@@ -1073,6 +1073,11 @@  static int rsnd_probe(struct platform_device *pdev)
 
 exit_snd_soc:
 	snd_soc_unregister_platform(dev);
+exit_snd_probe:
+	for_each_rsnd_dai(rdai, priv, i) {
+		rsnd_dai_call(remove, &rdai->playback, rdai);
+		rsnd_dai_call(remove, &rdai->capture, rdai);
+	}
 
 	return ret;
 }
@@ -1081,21 +1086,16 @@  static int rsnd_remove(struct platform_device *pdev)
 {
 	struct rsnd_priv *priv = dev_get_drvdata(&pdev->dev);
 	struct rsnd_dai *rdai;
-	int ret, i;
+	int ret = 0, i;
 
 	pm_runtime_disable(&pdev->dev);
 
 	for_each_rsnd_dai(rdai, priv, i) {
-		ret = rsnd_dai_call(remove, &rdai->playback, rdai);
-		if (ret)
-			return ret;
-
-		ret = rsnd_dai_call(remove, &rdai->capture, rdai);
-		if (ret)
-			return ret;
+		ret |= rsnd_dai_call(remove, &rdai->playback, rdai);
+		ret |= rsnd_dai_call(remove, &rdai->capture, rdai);
 	}
 
-	return 0;
+	return ret;
 }
 
 static struct platform_driver rsnd_driver = {