Commit ef354b53 authored by Zhouyang Jia's avatar Zhouyang Jia Committed by Kleber Sacilotto de Souza

ALSA: emu10k1: add error handling for snd_ctl_add

BugLink: https://bugs.launchpad.net/bugs/1791953

[ Upstream commit 6d531e7b ]

When snd_ctl_add fails, the lack of error-handling code may
cause unexpected results.

This patch adds error-handling code after calling snd_ctl_add.
Signed-off-by: default avatarZhouyang Jia <jiazhouyang09@gmail.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 404d1179
...@@ -1850,7 +1850,9 @@ int snd_emu10k1_pcm_efx(struct snd_emu10k1 *emu, int device) ...@@ -1850,7 +1850,9 @@ int snd_emu10k1_pcm_efx(struct snd_emu10k1 *emu, int device)
if (!kctl) if (!kctl)
return -ENOMEM; return -ENOMEM;
kctl->id.device = device; kctl->id.device = device;
snd_ctl_add(emu->card, kctl); err = snd_ctl_add(emu->card, kctl);
if (err < 0)
return err;
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci), 64*1024, 64*1024); snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci), 64*1024, 64*1024);
......
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