···15021502static int snd_seq_ioctl_create_queue(struct snd_seq_client *client, void *arg)15031503{15041504 struct snd_seq_queue_info *info = arg;15051505- int result;15061505 struct snd_seq_queue *q;1507150615081508- result = snd_seq_queue_alloc(client->number, info->locked, info->flags);15091509- if (result < 0)15101510- return result;15111511-15121512- q = queueptr(result);15131513- if (q == NULL)15141514- return -EINVAL;15071507+ q = snd_seq_queue_alloc(client->number, info->locked, info->flags);15081508+ if (IS_ERR(q))15091509+ return PTR_ERR(q);1515151015161511 info->queue = q->queue;15171512 info->locked = q->locked;···15161521 if (!info->name[0])15171522 snprintf(info->name, sizeof(info->name), "Queue-%d", q->queue);15181523 strlcpy(q->name, info->name, sizeof(q->name));15191519- queuefree(q);15241524+ snd_use_lock_free(&q->use_lock);1520152515211526 return 0;15221527}
+9-5
sound/core/seq/seq_queue.c
···184184static void queue_use(struct snd_seq_queue *queue, int client, int use);185185186186/* allocate a new queue -187187- * return queue index value or negative value for error187187+ * return pointer to new queue or ERR_PTR(-errno) for error188188+ * The new queue's use_lock is set to 1. It is the caller's responsibility to189189+ * call snd_use_lock_free(&q->use_lock).188190 */189189-int snd_seq_queue_alloc(int client, int locked, unsigned int info_flags)191191+struct snd_seq_queue *snd_seq_queue_alloc(int client, int locked, unsigned int info_flags)190192{191193 struct snd_seq_queue *q;192194193195 q = queue_new(client, locked);194196 if (q == NULL)195195- return -ENOMEM;197197+ return ERR_PTR(-ENOMEM);196198 q->info_flags = info_flags;197199 queue_use(q, client, 1);200200+ snd_use_lock_use(&q->use_lock);198201 if (queue_list_add(q) < 0) {202202+ snd_use_lock_free(&q->use_lock);199203 queue_delete(q);200200- return -ENOMEM;204204+ return ERR_PTR(-ENOMEM);201205 }202202- return q->queue;206206+ return q;203207}204208205209/* delete a queue - queue must be owned by the client */
+1-1
sound/core/seq/seq_queue.h
···717172727373/* create new queue (constructor) */7474-int snd_seq_queue_alloc(int client, int locked, unsigned int flags);7474+struct snd_seq_queue *snd_seq_queue_alloc(int client, int locked, unsigned int flags);75757676/* delete queue (destructor) */7777int snd_seq_queue_delete(int client, int queueid);
+6-1
sound/firewire/iso-resources.c
···210210 */211211void fw_iso_resources_free(struct fw_iso_resources *r)212212{213213- struct fw_card *card = fw_parent_device(r->unit)->card;213213+ struct fw_card *card;214214 int bandwidth, channel;215215+216216+ /* Not initialized. */217217+ if (r->unit == NULL)218218+ return;219219+ card = fw_parent_device(r->unit)->card;215220216221 mutex_lock(&r->mutex);217222