mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ALSA: emu10k1: add error handling for snd_ctl_add
@ 2018-06-11  8:18 Zhouyang Jia
  2018-06-11 13:26 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Zhouyang Jia @ 2018-06-11  8:18 UTC (permalink / raw)
  Cc: Zhouyang Jia, Jaroslav Kysela, Takashi Iwai, Bhumika Goyal,
	Maciej S. Szmigiero, alsa-devel, linux-kernel

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>
---
 sound/pci/emu10k1/emupcm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c
index d39458a..69f9b10 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);
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ALSA: emu10k1: add error handling for snd_ctl_add
  2018-06-11  8:18 [PATCH] ALSA: emu10k1: add error handling for snd_ctl_add Zhouyang Jia
@ 2018-06-11 13:26 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2018-06-11 13:26 UTC (permalink / raw)
  To: Zhouyang Jia
  Cc: alsa-devel, Bhumika Goyal, Maciej S. Szmigiero, Jaroslav Kysela,
	linux-kernel

On Mon, 11 Jun 2018 10:18:40 +0200,
Zhouyang Jia wrote:
> 
> 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>

Applied, thanks.


Takashi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-11 13:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-11  8:18 [PATCH] ALSA: emu10k1: add error handling for snd_ctl_add Zhouyang Jia
2018-06-11 13:26 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®