[alsa-devel] [PATCH][RFC] ASoC: soc-pcm: fixup module_put() calling timing

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Fri May 17 10:16:35 CEST 2019


From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>

soc_pcm_components_close() try to call module_put()
based on component->driver->module_get_upon_open.
But, it should be called even though it doesn't have .close callback.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
Mark, Pierre-Louis, Vinod, Liam

I think this patch is correct, but I'm not sure.
I'm happy if someone can confirm it.

 sound/soc/soc-pcm.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 7b4cda6..e24eab3 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -477,11 +477,9 @@ static int soc_pcm_components_close(struct snd_pcm_substream *substream,
 		if (component == last)
 			break;
 
-		if (!component->driver->ops ||
-		    !component->driver->ops->close)
-			continue;
-
-		component->driver->ops->close(substream);
+		if (component->driver->ops &&
+		    component->driver->ops->close)
+			component->driver->ops->close(substream);
 
 		if (component->driver->module_get_upon_open)
 			module_put(component->dev->driver->owner);
-- 
2.7.4



More information about the Alsa-devel mailing list