瀏覽代碼

lib: list_sort_test(): return -ENOMEM when allocation fails

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Cc: Don Mullis <don.mullis@gmail.com>
Cc: Dave Chinner <david@fromorbit.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Rasmus Villemoes 11 年之前
父節點
當前提交
27d555d101
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      lib/list_sort.c

+ 2 - 1
lib/list_sort.c

@@ -207,7 +207,7 @@ static int __init cmp(void *priv, struct list_head *a, struct list_head *b)
 
 
 static int __init list_sort_test(void)
 static int __init list_sort_test(void)
 {
 {
-	int i, count = 1, err = -EINVAL;
+	int i, count = 1, err = -ENOMEM;
 	struct debug_el *el;
 	struct debug_el *el;
 	struct list_head *cur, *tmp;
 	struct list_head *cur, *tmp;
 	LIST_HEAD(head);
 	LIST_HEAD(head);
@@ -239,6 +239,7 @@ static int __init list_sort_test(void)
 
 
 	list_sort(NULL, &head, cmp);
 	list_sort(NULL, &head, cmp);
 
 
+	err = -EINVAL;
 	for (cur = head.next; cur->next != &head; cur = cur->next) {
 	for (cur = head.next; cur->next != &head; cur = cur->next) {
 		struct debug_el *el1;
 		struct debug_el *el1;
 		int cmp_result;
 		int cmp_result;