snd_hda_get_conn_index() returns a negative value while the current code
stores it in an unsigned int. It must be stored in a signed integer.
Reported-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
static hda_nid_t get_adc(struct hda_codec *codec, hda_nid_t pin,
unsigned int *idxp)
{
- int i;
+ int i, idx;
hda_nid_t nid;
nid = codec->start_nid;
type = get_wcaps_type(get_wcaps(codec, nid));
if (type != AC_WID_AUD_IN)
continue;
- *idxp = snd_hda_get_conn_index(codec, nid, pin, false);
- if (*idxp >= 0)
+ idx = snd_hda_get_conn_index(codec, nid, pin, false);
+ if (idx >= 0) {
+ *idxp = idx;
return nid;
+ }
}
return 0;
}