ALSA: ac97 - Fix missing NULL check in snd_ac97_cvol_new()
authorTakashi Iwai <tiwai@suse.de>
Thu, 11 Oct 2012 14:43:40 +0000 (16:43 +0200)
committerTakashi Iwai <tiwai@suse.de>
Mon, 15 Oct 2012 07:55:48 +0000 (09:55 +0200)
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=44721

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/ac97/ac97_codec.c

index 9473fca..8b0f996 100644 (file)
@@ -1271,6 +1271,8 @@ static int snd_ac97_cvol_new(struct snd_card *card, char *name, int reg, unsigne
                tmp.index = ac97->num;
                kctl = snd_ctl_new1(&tmp, ac97);
        }
                tmp.index = ac97->num;
                kctl = snd_ctl_new1(&tmp, ac97);
        }
+       if (!kctl)
+               return -ENOMEM;
        if (reg >= AC97_PHONE && reg <= AC97_PCM)
                set_tlv_db_scale(kctl, db_scale_5bit_12db_max);
        else
        if (reg >= AC97_PHONE && reg <= AC97_PCM)
                set_tlv_db_scale(kctl, db_scale_5bit_12db_max);
        else