lib: list_sort_test(): return -ENOMEM when allocation fails
[firefly-linux-kernel-4.4.55.git] / lib / list_sort.c
index 1183fa70a44d26cfc673b6d5d2f645b7026f50dd..291412ade89a7c39acc4d03705de59488b761860 100644 (file)
@@ -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)
 {
-       int i, count = 1, err = -EINVAL;
+       int i, count = 1, err = -ENOMEM;
        struct debug_el *el;
        struct list_head *cur, *tmp;
        LIST_HEAD(head);
@@ -239,6 +239,7 @@ static int __init list_sort_test(void)
 
        list_sort(NULL, &head, cmp);
 
+       err = -EINVAL;
        for (cur = head.next; cur->next != &head; cur = cur->next) {
                struct debug_el *el1;
                int cmp_result;