Commit 428306c3 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: soc-pcm: fixup try_module_get()/module_put() timing

soc_pcm_components_open/close() try to call
try_module_get()/module_put() based on
component->driver->module_get_upon_open.

Here, the purpose why we need to call these functions are to
checking module reference.
Thus, we need to call try_module_open() even though it doesn't
have .open callback.

The same reason, we need to call module_put() even though it
doesn't have .close

This patch calls try_module_get()/module_put() regardless of
.open/.close
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent b385256e
......@@ -458,10 +458,6 @@ static int soc_pcm_components_open(struct snd_pcm_substream *substream,
component = rtdcom->component;
*last = component;
if (!component->driver->ops ||
!component->driver->ops->open)
continue;
if (component->driver->module_get_upon_open &&
!try_module_get(component->dev->driver->owner)) {
dev_err(component->dev,
......@@ -470,6 +466,10 @@ static int soc_pcm_components_open(struct snd_pcm_substream *substream,
return -ENODEV;
}
if (!component->driver->ops ||
!component->driver->ops->open)
continue;
ret = component->driver->ops->open(substream);
if (ret < 0) {
dev_err(component->dev,
......@@ -495,10 +495,8 @@ static int soc_pcm_components_close(struct snd_pcm_substream *substream,
if (component == last)
break;
if (!component->driver->ops ||
!component->driver->ops->close)
continue;
if (component->driver->ops &&
component->driver->ops->close)
component->driver->ops->close(substream);
if (component->driver->module_get_upon_open)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment