Message ID | 20190408193025.22639-1-ranjani.sridharan@linux.intel.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 7df8e234449a9a1cd2af5de728b7f811346c6fec |
Headers | show |
Series | ASoC: pcm: fix error handling when try_module_get() fails. | expand |
On Mon, Apr 08, 2019 at 12:30:25PM -0700, Ranjani Sridharan wrote: > 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> You keep on adding blank lines after your Fixes: lines for some reason, this is unusual and will probably confuse some tooling.
On Wed, 2019-04-10 at 10:50 +0100, Mark Brown wrote: > On Mon, Apr 08, 2019 at 12:30:25PM -0700, Ranjani Sridharan wrote: > > 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 > > > > > You keep on adding blank lines after your Fixes: lines for some > reason, > this is unusual and will probably confuse some tooling. Sorry about that. Will send v2 without the line. Thanks, Ranjani > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@alsa-project.org > https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
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 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) 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:
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> --- sound/soc/soc-pcm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)