diff options
author | Ranjani Sridharan <ranjani.sridharan@linux.intel.com> | 2019-04-08 12:30:25 -0700 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-04-10 12:28:00 +0100 |
commit | 70802487bb9145a4f8b26f5a11d0e7f83c25100a (patch) | |
tree | f43925307a15d57372c82db12db1dbb24fd6caf0 | |
parent | e37c2deafe7058cf7989c4c47bbf1140cc867d89 (diff) |
ASoC: pcm: fix error handling when try_module_get() fails.
Handle error before returning when try_module_get() fails
to prevent inconsistent mutex lock/unlock.
Fixes: 52034add7 (ASoC: pcm: update module refcount if
module_get_upon_open is set)
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/soc-pcm.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index d21247546f7f..be80a12fba27 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -518,8 +518,10 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) continue; if (component->driver->module_get_upon_open && - !try_module_get(component->dev->driver->owner)) - return -ENODEV; + !try_module_get(component->dev->driver->owner)) { + ret = -ENODEV; + goto module_err; + } ret = component->driver->ops->open(substream); if (ret < 0) { @@ -636,7 +638,7 @@ codec_dai_err: component_err: soc_pcm_components_close(substream, component); - +module_err: if (cpu_dai->driver->ops->shutdown) cpu_dai->driver->ops->shutdown(substream, cpu_dai); out: |