Commit c2f51415 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: gus: Fix erroneous memory allocation

snd_gf1_mem_xalloc() returns NULL incorrectly when the memory chunk is
allocated in the middle of the chain.  This patch corrects the return
value to treat it properly.
Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20211213132444.22385-1-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 78977fd5
...@@ -44,7 +44,7 @@ static struct snd_gf1_mem_block *snd_gf1_mem_xalloc(struct snd_gf1_mem * alloc, ...@@ -44,7 +44,7 @@ static struct snd_gf1_mem_block *snd_gf1_mem_xalloc(struct snd_gf1_mem * alloc,
else else
nblock->prev->next = nblock; nblock->prev->next = nblock;
mutex_unlock(&alloc->memory_mutex); mutex_unlock(&alloc->memory_mutex);
return NULL; return nblock;
} }
pblock = pblock->next; pblock = pblock->next;
} }
......
Markdown is supported
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