* [PATCH] hda: check make_exec_verb() return value
@ 2011-06-13 14:45 Greg Thelen
2011-06-13 15:52 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Greg Thelen @ 2011-06-13 14:45 UTC (permalink / raw)
To: Jaroslav Kysela, Takashi Iwai; +Cc: alsa-devel, linux-kernel, Greg Thelen
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>
---
sound/pci/hda/hda_codec.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 45b4a8d..f06dd5f 100644
--- 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 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);
--
1.7.3.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] hda: check make_exec_verb() return value
2011-06-13 14:45 [PATCH] hda: check make_exec_verb() return value Greg Thelen
@ 2011-06-13 15:52 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2011-06-13 15:52 UTC (permalink / raw)
To: Greg Thelen; +Cc: Jaroslav Kysela, alsa-devel, linux-kernel
At Mon, 13 Jun 2011 07:45:45 -0700,
Greg Thelen wrote:
>
> 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>
Applied now. Thanks.
Takashi
> ---
> sound/pci/hda/hda_codec.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
> index 45b4a8d..f06dd5f 100644
> --- 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 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);
> --
> 1.7.3.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-06-13 15:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-13 14:45 [PATCH] hda: check make_exec_verb() return value Greg Thelen
2011-06-13 15:52 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®