Linux Media Controller development
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: linux-media@vger.kernel.org
Subject: [PATCH] tlg2300: fix missing check for audio creation
Date: Tue, 04 Sep 2012 15:43:26 +0100	[thread overview]
Message-ID: <20120904144319.25311.50526.stgit@localhost.localdomain> (raw)

From: Alan Cox <alan@linux.intel.com>

If we fail to set up the capture device we go through negative indexes and
badness happens. Add the missing test.

Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=44551
Signed-off-by: Alan Cox <alan@linux.intel.com>
---

 drivers/media/usb/tlg2300/pd-alsa.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/media/usb/tlg2300/pd-alsa.c b/drivers/media/usb/tlg2300/pd-alsa.c
index 9f8b7da..0c77869 100644
--- a/drivers/media/usb/tlg2300/pd-alsa.c
+++ b/drivers/media/usb/tlg2300/pd-alsa.c
@@ -305,6 +305,10 @@ int poseidon_audio_init(struct poseidon *p)
 		return ret;
 
 	ret = snd_pcm_new(card, "poseidon audio", 0, 0, 1, &pcm);
+	if (ret < 0) {
+		snd_free_card(card);
+		return ret;
+	}
 	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &pcm_capture_ops);
 	pcm->info_flags   = 0;
 	pcm->private_data = p;


             reply	other threads:[~2012-09-04 14:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-04 14:43 Alan Cox [this message]
2012-09-23 19:51 ` [PATCH] tlg2300: fix missing check for audio creation Mauro Carvalho Chehab

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=20120904144319.25311.50526.stgit@localhost.localdomain \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=linux-media@vger.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