summaryrefslogtreecommitdiff
path: root/sound/pci
diff options
context:
space:
mode:
authorZhouyang Jia <jiazhouyang09@gmail.com>2018-06-11 16:18:40 +0800
committerTakashi Iwai <tiwai@suse.de>2018-06-11 15:23:00 +0200
commit6d531e7b972cb62ded011c2dfcc2d9f72ea6c421 (patch)
treeb0c133c6a2eb2e9255970978a37e9f31dd493472 /sound/pci
parentef1ffbe7889e99f5b5cccb41c89e5c94f50f3218 (diff)
ALSA: emu10k1: add error handling for snd_ctl_add
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: Zhouyang Jia <jiazhouyang09@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/emu10k1/emupcm.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c
index d39458ab251f..69f9b100bd24 100644
--- a/sound/pci/emu10k1/emupcm.c
+++ b/sound/pci/emu10k1/emupcm.c
@@ -1858,7 +1858,9 @@ int snd_emu10k1_pcm_efx(struct snd_emu10k1 *emu, int device)
if (!kctl)
return -ENOMEM;
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);