diff mbox series

[ALSA] seq: add error check in snd_seq_system_client_init()

Message ID 20180828084634.5tlvwgc6znrqixro@kili.mountain (mailing list archive)
State New, archived
Headers show
Series [ALSA] seq: add error check in snd_seq_system_client_init() | expand

Commit Message

Dan Carpenter Aug. 28, 2018, 8:46 a.m. UTC
Static checkers complain that snd_seq_create_kernel_client() can return
-EBUSY here so we need to have some error handling.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Takashi Iwai Aug. 28, 2018, 9:09 a.m. UTC | #1
On Tue, 28 Aug 2018 10:46:34 +0200,
Dan Carpenter wrote:
> 
> Static checkers complain that snd_seq_create_kernel_client() can return
> -EBUSY here so we need to have some error handling.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied, thanks.

Also we need to fix the case where an error is returned from
snd_seq_kernel_client_ctl().  Will write up the patch soon later.


Takashi
diff mbox series

Patch

diff --git a/sound/core/seq/seq_system.c b/sound/core/seq/seq_system.c
index 8ce1d0b40dce..3b89b0adad6a 100644
--- a/sound/core/seq/seq_system.c
+++ b/sound/core/seq/seq_system.c
@@ -134,6 +134,10 @@  int __init snd_seq_system_client_init(void)
 
 	/* register client */
 	sysclient = snd_seq_create_kernel_client(NULL, 0, "System");
+	if (sysclient < 0) {
+		kfree(port);
+		return sysclient;
+	}
 
 	/* register timer */
 	strcpy(port->name, "Timer");