User: | Jiri Slaby |
Error type: | Leaving function in locked state |
Error type description: | Some lock is not unlocked on all paths of a function, so it is leaked |
File location: | lib/genalloc.c |
Line in file: | 100 |
Project: | Linux Kernel |
Project version: | 2.6.28 |
Tools: |
Stanse
(1.2)
|
Entered: | 2012-05-21 20:30:05 UTC |
70} 71EXPORT_SYMBOL(gen_pool_add); 72 73/** 74 * gen_pool_destroy - destroy a special memory pool 75 * @pool: pool to destroy 76 * 77 * Destroy the specified special memory pool. Verifies that there are no 78 * outstanding allocations. 79 */ 80void gen_pool_destroy(struct gen_pool *pool) 81{ 82 struct list_head *_chunk, *_next_chunk; 83 struct gen_pool_chunk *chunk; 84 int order = pool->min_alloc_order; 85 int bit, end_bit; 86 87 88 write_lock(&pool->lock); 89 list_for_each_safe(_chunk, _next_chunk, &pool->chunks) { 90 chunk = list_entry(_chunk, struct gen_pool_chunk, next_chunk); 91 list_del(&chunk->next_chunk); 92 93 end_bit = (chunk->end_addr - chunk->start_addr) >> order; 94 bit = find_next_bit(chunk->bits, end_bit, 0); 95 BUG_ON(bit < end_bit); 96 97 kfree(chunk); 98 } 99 kfree(pool); 100 return; 101} 102EXPORT_SYMBOL(gen_pool_destroy); 103 104/** 105 * gen_pool_alloc - allocate special memory from the pool 106 * @pool: pool to allocate from 107 * @size: number of bytes to allocate from the pool 108 * 109 * Allocate the requested number of bytes from the specified pool. 110 * Uses a first-fit algorithm.