Skip to content

Commit

Permalink
ALSA: hda: check make_exec_verb() return value
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
gthelen authored and tiwai committed Jun 13, 2011
1 parent 5ab775c commit 9857edf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sound/pci/hda/hda_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ unsigned int snd_hda_codec_read(struct hda_codec *codec, hda_nid_t nid,
{
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);
Expand Down

0 comments on commit 9857edf

Please sign in to comment.