Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1b004d03 authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: hda - Fix error check from snd_hda_get_conn_index() in patch_cirrus.c



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: default avatarJesper Juhl <jj@chaosbits.net>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent b6acf013
Loading
Loading
Loading
Loading
+5 −3
Original line number Original line Diff line number Diff line
@@ -375,7 +375,7 @@ static int is_ext_mic(struct hda_codec *codec, unsigned int idx)
static hda_nid_t get_adc(struct hda_codec *codec, hda_nid_t pin,
static hda_nid_t get_adc(struct hda_codec *codec, hda_nid_t pin,
			 unsigned int *idxp)
			 unsigned int *idxp)
{
{
	int i;
	int i, idx;
	hda_nid_t nid;
	hda_nid_t nid;


	nid = codec->start_nid;
	nid = codec->start_nid;
@@ -384,10 +384,12 @@ static hda_nid_t get_adc(struct hda_codec *codec, hda_nid_t pin,
		type = get_wcaps_type(get_wcaps(codec, nid));
		type = get_wcaps_type(get_wcaps(codec, nid));
		if (type != AC_WID_AUD_IN)
		if (type != AC_WID_AUD_IN)
			continue;
			continue;
		*idxp = snd_hda_get_conn_index(codec, nid, pin, false);
		idx = snd_hda_get_conn_index(codec, nid, pin, false);
		if (*idxp >= 0)
		if (idx >= 0) {
			*idxp = idx;
			return nid;
			return nid;
		}
		}
	}
	return 0;
	return 0;
}
}