diff options
author | Rasmus Villemoes <linux@rasmusvillemoes.dk> | 2014-08-06 19:09:38 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-06 21:01:25 -0400 |
commit | 27d555d101c820ac4b1962680bd0192993c6e4e0 (patch) | |
tree | 4c1a40359657bd3bcc36c77e4b99c1ededabec14 /lib | |
parent | 087face5265026d4fe664bdb580f4904bd10cfbf (diff) |
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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/list_sort.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/list_sort.c b/lib/list_sort.c index 1183fa70a44d..291412ade89a 100644 --- a/lib/list_sort.c +++ b/lib/list_sort.c | |||
@@ -207,7 +207,7 @@ static int __init cmp(void *priv, struct list_head *a, struct list_head *b) | |||
207 | 207 | ||
208 | static int __init list_sort_test(void) | 208 | static int __init list_sort_test(void) |
209 | { | 209 | { |
210 | int i, count = 1, err = -EINVAL; | 210 | int i, count = 1, err = -ENOMEM; |
211 | struct debug_el *el; | 211 | struct debug_el *el; |
212 | struct list_head *cur, *tmp; | 212 | struct list_head *cur, *tmp; |
213 | LIST_HEAD(head); | 213 | LIST_HEAD(head); |
@@ -239,6 +239,7 @@ static int __init list_sort_test(void) | |||
239 | 239 | ||
240 | list_sort(NULL, &head, cmp); | 240 | list_sort(NULL, &head, cmp); |
241 | 241 | ||
242 | err = -EINVAL; | ||
242 | for (cur = head.next; cur->next != &head; cur = cur->next) { | 243 | for (cur = head.next; cur->next != &head; cur = cur->next) { |
243 | struct debug_el *el1; | 244 | struct debug_el *el1; |
244 | int cmp_result; | 245 | int cmp_result; |