|
@@ -383,15 +383,20 @@ int snd_seq_pool_init(struct snd_seq_pool *pool)
|
|
|
|
|
|
if (snd_BUG_ON(!pool))
|
|
if (snd_BUG_ON(!pool))
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
- if (pool->ptr) /* should be atomic? */
|
|
|
|
- return 0;
|
|
|
|
|
|
|
|
- pool->ptr = vmalloc(sizeof(struct snd_seq_event_cell) * pool->size);
|
|
|
|
- if (!pool->ptr)
|
|
|
|
|
|
+ cellptr = vmalloc(sizeof(struct snd_seq_event_cell) * pool->size);
|
|
|
|
+ if (!cellptr)
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
|
|
|
|
/* add new cells to the free cell list */
|
|
/* add new cells to the free cell list */
|
|
spin_lock_irqsave(&pool->lock, flags);
|
|
spin_lock_irqsave(&pool->lock, flags);
|
|
|
|
+ if (pool->ptr) {
|
|
|
|
+ spin_unlock_irqrestore(&pool->lock, flags);
|
|
|
|
+ vfree(cellptr);
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ pool->ptr = cellptr;
|
|
pool->free = NULL;
|
|
pool->free = NULL;
|
|
|
|
|
|
for (cell = 0; cell < pool->size; cell++) {
|
|
for (cell = 0; cell < pool->size; cell++) {
|