/* * generic arrays */ #include <linux/slab.h> #include <sound/core.h> #include <sound/hdaudio.h> /** * snd_array_new - get a new element from the given array * @array: the array object * * Get a new element from the given array. If it exceeds the * pre-allocated array size, re-allocate the array. * * Returns NULL if allocation failed. */ void *snd_array_new(struct snd_array *array) { if (snd_BUG_ON(!array->elem_size)) return NULL; if (array->used >= array->alloced) { int num = array->alloced + array->alloc_align; int oldsize = array->alloced * array->elem_size; int size = (num + 1) * array->elem_size; void *nlist; if (snd_BUG_ON(num >= 4096)) return NULL; nlist = krealloc(array->list, size, GFP_KERNEL); if (!nlist) return NULL; memset(nlist + oldsize, 0, size - oldsize); array->list = nlist; array->alloced = num; } return snd_array_elem(array, array->used++); } EXPORT_SYMBOL_GPL(snd_array_new); /** * snd_array_free - free the given array elements * @array: the array object */ void snd_array_free(struct snd_array *array) { kfree(array->list); array->used = 0; array->alloced = 0; array->list = NULL; } EXPORT_SYMBOL_GPL(snd_array_free); 'packet-loop-back'>packet-loop-back</option> <option value='packet-rx-pump-back'>packet-rx-pump-back</option> </select> <input type='submit' value='switch'/></form></td></tr> <tr><td class='sub'>net-next plumbings</td><td class='sub right'>Tobias Klauser</td></tr></table> <table class='tabs'><tr><td> <a href='/cgit.cgi/linux/net-next.git/'>summary</a><a href='/cgit.cgi/linux/net-next.git/refs/?id=5a0fd98b7b5be8773c53c40c47451ec6cd11d1ff'>refs</a><a class='active' href='/cgit.cgi/linux/net-next.git/log/tools/testing/selftests/mount/Makefile'>log</a><a href='/cgit.cgi/linux/net-next.git/tree/tools/testing/selftests/mount/Makefile?id=5a0fd98b7b5be8773c53c40c47451ec6cd11d1ff'>tree</a><a href='/cgit.cgi/linux/net-next.git/commit/tools/testing/selftests/mount/Makefile?id=5a0fd98b7b5be8773c53c40c47451ec6cd11d1ff'>commit</a><a href='/cgit.cgi/linux/net-next.git/diff/tools/testing/selftests/mount/Makefile?id=5a0fd98b7b5be8773c53c40c47451ec6cd11d1ff'>diff</a></td><td class='form'><form class='right' method='get' action='/cgit.cgi/linux/net-next.git/log/tools/testing/selftests/mount/Makefile'> <input type='hidden' name='id' value='5a0fd98b7b5be8773c53c40c47451ec6cd11d1ff'/><select name='qt'> <option value='grep'>log msg</option> <option value='author'>author</option> <option value='committer'>committer</option> <option value='range'>range</option> </select> <input class='txt' type='search' size='10' name='q' value=''/> <input type='submit' value='search'/> </form> </td></tr></table> <div class='path'>path: <a href='/cgit.cgi/linux/net-next.git/log/?id=5a0fd98b7b5be8773c53c40c47451ec6cd11d1ff'>root</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools?id=5a0fd98b7b5be8773c53c40c47451ec6cd11d1ff'>tools</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools/testing?id=5a0fd98b7b5be8773c53c40c47451ec6cd11d1ff'>testing</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools/testing/selftests?id=5a0fd98b7b5be8773c53c40c47451ec6cd11d1ff'>selftests</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools/testing/selftests/mount?id=5a0fd98b7b5be8773c53c40c47451ec6cd11d1ff'>mount</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools/testing/selftests/mount/Makefile?id=5a0fd98b7b5be8773c53c40c47451ec6cd11d1ff'>Makefile</a></div><div class='content'><table class='list nowrap'><tr class='nohover'><th class='left'>Age</th><th class='left'>Commit message (<a href='/cgit.cgi/linux/net-next.git/log/tools/testing/selftests/mount/Makefile?id=5a0fd98b7b5be8773c53c40c47451ec6cd11d1ff&showmsg=1'>Expand</a>)</th><th class='left'>Author</th><th class='left'>Files</th><th class='left'>Lines</th></tr> te-remove&id=937b682cc0bcebe19df7911f3697be7fd8c5dee6&showmsg=1'>Expand</a>)</th><th class='left'>Author</th><th class='left'>Files</th><th class='left'>Lines</th></tr>