linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jerome Brunet <jbrunet@baylibre.com>
To: Mark Brown <broonie@kernel.org>, Liam Girdwood <lgirdwood@gmail.com>
Cc: Jerome Brunet <jbrunet@baylibre.com>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	patchwork-bot+notify@kernel.org
Subject: [PATCH 2/6] ASoC: hdmi-codec: unlock the device on startup errors
Date: Mon, 29 Apr 2019 15:29:39 +0200	[thread overview]
Message-ID: <20190429132943.16269-3-jbrunet@baylibre.com> (raw)
In-Reply-To: <20190429132943.16269-1-jbrunet@baylibre.com>

If the hdmi codec startup fails, it should clear the current_substream
pointer to free the device. This is properly done for the audio_startup()
callback but for snd_pcm_hw_constraint_eld().

Make sure the pointer cleared if an error is reported.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
 sound/soc/codecs/hdmi-codec.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
index 9dca24732069..4bd598253c62 100644
--- a/sound/soc/codecs/hdmi-codec.c
+++ b/sound/soc/codecs/hdmi-codec.c
@@ -437,8 +437,12 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream,
 		if (!ret) {
 			ret = snd_pcm_hw_constraint_eld(substream->runtime,
 							hcp->eld);
-			if (ret)
+			if (ret) {
+				mutex_lock(&hcp->current_stream_lock);
+				hcp->current_stream = NULL;
+				mutex_unlock(&hcp->current_stream_lock);
 				return ret;
+			}
 		}
 		/* Select chmap supported */
 		hdmi_codec_eld_chmap(hcp);
-- 
2.20.1


  parent reply	other threads:[~2019-04-29 13:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-29 13:29 [PATCH 0/6] ASoC: hdmi-codec: fixes and improvements Jerome Brunet
2019-04-29 13:29 ` [PATCH 1/6] ASoC: hdmi-codec: remove function name debug traces Jerome Brunet
2019-05-03  6:17   ` Mark Brown
2019-04-29 13:29 ` Jerome Brunet [this message]
2019-05-03  6:18   ` Applied "ASoC: hdmi-codec: unlock the device on startup errors" to the asoc tree Mark Brown
2019-05-03  6:21   ` Mark Brown
2019-05-03  6:23   ` Mark Brown
2019-04-29 13:29 ` [PATCH 3/6] ASoC: hdmi-codec: stream is already locked in hw_params Jerome Brunet
2019-05-03  6:18   ` Applied "ASoC: hdmi-codec: stream is already locked in hw_params" to the asoc tree Mark Brown
2019-05-03  6:21   ` Mark Brown
2019-05-03  6:23   ` Mark Brown
2019-04-29 13:29 ` [PATCH 4/6] ASoC: hdmi-codec: remove reference to the current substream Jerome Brunet
2019-04-29 13:29 ` [PATCH 5/6] ASoC: hdmi-codec: remove reference to the dai drivers in the private data Jerome Brunet
2019-04-29 13:29 ` [PATCH 6/6] ASoC: hdmi-codec: remove ops dependency on the dai id Jerome Brunet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190429132943.16269-3-jbrunet@baylibre.com \
    --to=jbrunet@baylibre.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patchwork-bot+notify@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).