File 0019-dmix-Don-t-use-assert-and-abort.patch of Package alsa

From 49ad6699e68862ef9888bdf10b5bdaa19933f1ea Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Wed, 27 Nov 2013 09:37:54 +0100
Subject: [PATCH] dmix: Don't use assert() and abort()

We seem to still have some races at closing a dmix stream, but
aborting is the worst option.  Let's make not melt down.

Reference: https://bugzilla.novell.com/show_bug.cgi?id=852446
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 src/pcm/pcm_direct.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/pcm/pcm_direct.h b/src/pcm/pcm_direct.h
index 70c2c6a0229f..5ae39c0e4237 100644
--- a/src/pcm/pcm_direct.h
+++ b/src/pcm/pcm_direct.h
@@ -274,8 +274,8 @@ static inline int snd_pcm_direct_semaphore_up(snd_pcm_direct_t *dmix, int sem_nu
 static inline int snd_pcm_direct_semaphore_final(snd_pcm_direct_t *dmix, int sem_num)
 {
 	if (dmix->locked[sem_num] != 1) {
-		assert(dmix->locked[sem_num] != 1);
-		abort();
+		SNDMSG("invalid semaphore count to finalize %d: %d", sem_num, dmix->locked[sem_num]);
+		return -EBUSY;
 	}
 	return snd_pcm_direct_semaphore_up(dmix, sem_num);
 }
-- 
1.8.4.3