diff options
author | Alex Shi <alex.shi@linaro.org> | 2016-03-14 14:26:30 +0800 |
---|---|---|
committer | Alex Shi <alex.shi@linaro.org> | 2016-03-14 14:26:30 +0800 |
commit | 82211c838b558293e48c8fcd816f6609ebc7e4b3 (patch) | |
tree | 1075d29efa4b2c71780986674c7052d16208ea6e /sound/core/seq/seq_memory.c | |
parent | 8fdeb0be4a89d1a869481ea847773513686b49ed (diff) | |
parent | 0f67c5beb42a8328e9e661dcfcc4d328b6138264 (diff) |
Merge tag 'v3.18.28' into linux-linaro-lsk-v3.18
This is the 3.18.28 stable release
Diffstat (limited to 'sound/core/seq/seq_memory.c')
-rw-r--r-- | sound/core/seq/seq_memory.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c index ba8e4a64e13e..c850345c43b5 100644 --- a/sound/core/seq/seq_memory.c +++ b/sound/core/seq/seq_memory.c @@ -383,17 +383,20 @@ int snd_seq_pool_init(struct snd_seq_pool *pool) if (snd_BUG_ON(!pool)) return -EINVAL; - if (pool->ptr) /* should be atomic? */ - return 0; - pool->ptr = vmalloc(sizeof(struct snd_seq_event_cell) * pool->size); - if (pool->ptr == NULL) { - pr_debug("ALSA: seq: malloc for sequencer events failed\n"); + cellptr = vmalloc(sizeof(struct snd_seq_event_cell) * pool->size); + if (!cellptr) return -ENOMEM; - } /* add new cells to the free cell list */ 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; for (cell = 0; cell < pool->size; cell++) { @@ -463,10 +466,8 @@ struct snd_seq_pool *snd_seq_pool_new(int poolsize) /* create pool block */ pool = kzalloc(sizeof(*pool), GFP_KERNEL); - if (pool == NULL) { - pr_debug("ALSA: seq: malloc failed for pool\n"); + if (!pool) return NULL; - } spin_lock_init(&pool->lock); pool->ptr = NULL; pool->free = NULL; |