[ALSA] hda-codec - Don't query widget parameter for invalid NID
authorTakashi Iwai <[email protected]>
Tue, 22 Jan 2008 14:37:13 +0000 (15:37 +0100)
committerJaroslav Kysela <[email protected]>
Thu, 31 Jan 2008 16:30:10 +0000 (17:30 +0100)
Don't query a widget parameter for an invalid NID in get_wcaps() but
rather returns zero (i.e. no attribute).
The read to an non-existing widget may result in a fatal codec
communication error.

Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Jaroslav Kysela <[email protected]>
sound/pci/hda/hda_local.h

index ddc61a1d1153c66b09264a31e23402b0e3c3bd78..448c4ce816c32c7484f046ae4834ce07f001fe3f 100644 (file)
@@ -370,7 +370,7 @@ static inline u32 get_wcaps(struct hda_codec *codec, hda_nid_t nid)
 {
        if (nid < codec->start_nid ||
            nid >= codec->start_nid + codec->num_nodes)
-               return snd_hda_param_read(codec, nid, AC_PAR_AUDIO_WIDGET_CAP);
+               return 0;
        return codec->wcaps[nid - codec->start_nid];
 }