]> git.baikalelectronics.ru Git - kernel.git/commit
lib/list_sort: test: improve errors handling
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Tue, 26 Oct 2010 21:23:07 +0000 (14:23 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 26 Oct 2010 23:52:19 +0000 (16:52 -0700)
commited92616a1a851db5ee2728420bbe1e2da92a2e6f
tree1c834baf780e16a9e47d1cacd41498dbb361483a
parent6a2246508a93fbb684159c594aa8a581384b19cf
lib/list_sort: test: improve errors handling

The 'lib_sort()' test does not free memory if it fails, and it makes the
kernel panic if it cannot allocate memory.  This patch fixes the problem.

This patch also changes several small things:
 o use 'list_add()' helper instead of adding manually
 o introduce temporary 'el1' variable to avoid ugly and unreadalbe
   "if" statement
 o make 'head' to be stack variable instead of 'kmalloc()'ed, which
   simplifies code a bit

Overall, this patch is of clean-up type.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Don Mullis <don.mullis@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
lib/list_sort.c