aboutsummaryrefslogtreecommitdiff
path: root/sound/core/seq/seq_queue.c
diff options
context:
space:
mode:
authorGravatar Takashi Iwai <tiwai@suse.de> 2017-08-22 15:44:45 +0200
committerGravatar Takashi Iwai <tiwai@suse.de> 2017-08-22 15:44:45 +0200
commit241bc82e62b28fdb7223b85180fd814f4963c971 (patch)
treef0d1a3889fd027e017faa37fc34bffe2fa038c41 /sound/core/seq/seq_queue.c
parentALSA: firewire-motu: add support for MOTU Audio Express (diff)
parentALSA: core: Fix unexpected error at replacing user TLV (diff)
downloadlinux-241bc82e62b28fdb7223b85180fd814f4963c971.tar.gz
linux-241bc82e62b28fdb7223b85180fd814f4963c971.tar.bz2
linux-241bc82e62b28fdb7223b85180fd814f4963c971.zip
Merge branch 'for-linus' into for-next
Conflicts: sound/core/control.c
Diffstat (limited to 'sound/core/seq/seq_queue.c')
-rw-r--r--sound/core/seq/seq_queue.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c
index 450c5187eecb..79e0c5604ef8 100644
--- a/sound/core/seq/seq_queue.c
+++ b/sound/core/seq/seq_queue.c
@@ -184,22 +184,26 @@ void __exit snd_seq_queues_delete(void)
static void queue_use(struct snd_seq_queue *queue, int client, int use);
/* allocate a new queue -
- * return queue index value or negative value for error
+ * return pointer to new queue or ERR_PTR(-errno) for error
+ * The new queue's use_lock is set to 1. It is the caller's responsibility to
+ * call snd_use_lock_free(&q->use_lock).
*/
-int snd_seq_queue_alloc(int client, int locked, unsigned int info_flags)
+struct snd_seq_queue *snd_seq_queue_alloc(int client, int locked, unsigned int info_flags)
{
struct snd_seq_queue *q;
q = queue_new(client, locked);
if (q == NULL)
- return -ENOMEM;
+ return ERR_PTR(-ENOMEM);
q->info_flags = info_flags;
queue_use(q, client, 1);
+ snd_use_lock_use(&q->use_lock);
if (queue_list_add(q) < 0) {
+ snd_use_lock_free(&q->use_lock);
queue_delete(q);
- return -ENOMEM;
+ return ERR_PTR(-ENOMEM);
}
- return q->queue;
+ return q;
}
/* delete a queue - queue must be owned by the client */