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>
This commit is contained in:
parent
e37c2deafe
commit
70802487bb
|
@ -518,8 +518,10 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (component->driver->module_get_upon_open &&
|
if (component->driver->module_get_upon_open &&
|
||||||
!try_module_get(component->dev->driver->owner))
|
!try_module_get(component->dev->driver->owner)) {
|
||||||
return -ENODEV;
|
ret = -ENODEV;
|
||||||
|
goto module_err;
|
||||||
|
}
|
||||||
|
|
||||||
ret = component->driver->ops->open(substream);
|
ret = component->driver->ops->open(substream);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
@ -636,7 +638,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
|
||||||
|
|
||||||
component_err:
|
component_err:
|
||||||
soc_pcm_components_close(substream, component);
|
soc_pcm_components_close(substream, component);
|
||||||
|
module_err:
|
||||||
if (cpu_dai->driver->ops->shutdown)
|
if (cpu_dai->driver->ops->shutdown)
|
||||||
cpu_dai->driver->ops->shutdown(substream, cpu_dai);
|
cpu_dai->driver->ops->shutdown(substream, cpu_dai);
|
||||||
out:
|
out:
|
||||||
|
|
Loading…
Reference in New Issue