Skip to content
Commit 67de40c9 authored by Su Hui's avatar Su Hui Committed by Takashi Iwai
Browse files

ALSA: ac97: Fix possible error value of *rac97



Before committing 79597c8b, *rac97 always be NULL if there is
an error. When error happens, make sure *rac97 is NULL is safer.

For examble, in snd_vortex_mixer():
	err = snd_ac97_mixer(pbus, &ac97, &vortex->codec);
	vortex->isquad = ((vortex->codec == NULL) ?
		0 : (vortex->codec->ext_id&0x80));
If error happened but vortex->codec isn't NULL, this may cause some
problems.

Move the judgement order to be clearer and better.

Fixes: 79597c8b ("ALSA: ac97: Fix possible NULL dereference in snd_ac97_mixer")
Suggested-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: default avatarSu Hui <suhui@nfschina.com>
Link: https://lore.kernel.org/r/20230823025212.1000961-1-suhui@nfschina.com


Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 22459ef3
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment