From: Takashi Iwai Date: Mon, 13 Dec 2021 13:24:43 +0000 (+0100) Subject: ALSA: gus: Fix erroneous memory allocation X-Git-Tag: v5.17-rc1~86^2~16^2~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c2f51415401cb8e9b7991e828ae12ab2972f2ca7;p=thirdparty%2Flinux.git 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: Jaroslav Kysela Link: https://lore.kernel.org/r/20211213132444.22385-1-tiwai@suse.de Signed-off-by: Takashi Iwai --- diff --git a/sound/isa/gus/gus_mem.c b/sound/isa/gus/gus_mem.c index 4c691dbf27211..5e3ff3137dd74 100644 --- a/sound/isa/gus/gus_mem.c +++ b/sound/isa/gus/gus_mem.c @@ -44,7 +44,7 @@ static struct snd_gf1_mem_block *snd_gf1_mem_xalloc(struct snd_gf1_mem * alloc, else nblock->prev->next = nblock; mutex_unlock(&alloc->memory_mutex); - return NULL; + return nblock; } pblock = pblock->next; }