From 9857edfd4db0dc879f786e042f24900fd683b0ac Mon Sep 17 00:00:00 2001
From: Greg Thelen <gthelen@google.com>
Date: Mon, 13 Jun 2011 07:45:45 -0700
Subject: [PATCH] ALSA: hda: check make_exec_verb() return value
Git-commit: 9857edfd4db0dc879f786e042f24900fd683b0ac
Patch-mainline: 3.1-rc2
Refernces: FATE#314106,FATE#314311,FATE#313695

If given a -1 cmd parameter then make_exec_verb() returns -1 without
setting the res output value.

Prior to this change snd_hda_codec_read() assumed that make_exec_verb()
unconditionally set res regardless of the cmd value.

This change explicitly checks the make_exec_verb() return value before
consuming the potentially unset res value.

Signed-off-by: Greg Thelen <gthelen@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

---
 sound/pci/hda/hda_codec.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -243,7 +243,8 @@ unsigned int snd_hda_codec_read(struct h
 {
 	unsigned cmd = make_codec_cmd(codec, nid, direct, verb, parm);
 	unsigned int res;
-	codec_exec_verb(codec, cmd, &res);
+	if (codec_exec_verb(codec, cmd, &res))
+		return -1;
 	return res;
 }
 EXPORT_SYMBOL_HDA(snd_hda_codec_read);
