summaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorXiaoke Wang <xkernel.wang@foxmail.com>2022-03-04 16:38:20 +0800
committerTakashi Iwai <tiwai@suse.de>2022-03-04 09:51:37 +0100
commitd7f15befac809ba365742464e1b0bebf07149c58 (patch)
tree05f63aa0ba5dcf5795cf38c02593d7fca6016ae4 /sound/pci
parent3cffb26fbb5202c6a4bee4b99d6bef5623003fbb (diff)
downloadlinux-stable-d7f15befac809ba365742464e1b0bebf07149c58.tar.gz
linux-stable-d7f15befac809ba365742464e1b0bebf07149c58.tar.bz2
linux-stable-d7f15befac809ba365742464e1b0bebf07149c58.zip
ALSA: lola: add a check for the return of vmalloc()
vmalloc() is a memory allocation function which can return NULL when some internal memory errors happen. So it is better to check the return of it to catch the error in time. Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com> Link: https://lore.kernel.org/r/tencent_4221FC4089F6DF01C48F192E5784038BA205@qq.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/lola/lola_mixer.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/pci/lola/lola_mixer.c b/sound/pci/lola/lola_mixer.c
index e2c8f1417001..6b162489cb5f 100644
--- a/sound/pci/lola/lola_mixer.c
+++ b/sound/pci/lola/lola_mixer.c
@@ -121,6 +121,8 @@ int lola_init_mixer_widget(struct lola *chip, int nid)
/* reserve memory to copy mixer data for sleep mode transitions */
chip->mixer.array_saved = vmalloc(sizeof(struct lola_mixer_array));
+ if (!chip->mixer.array_saved)
+ return -ENOMEM;
/* mixer matrix sources are physical input data and play streams */
chip->mixer.src_stream_outs = chip->pcm[PLAY].num_streams;