aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/lib/test_list_sort.c
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2017-11-17 15:28:00 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-17 16:10:01 -0800
commitdc2bf000a2848cf1dee373db14ce2cd1fe3ee394 (patch)
treef3e52c19d108d51d0f8daa43a27235fce3a14ecf /lib/test_list_sort.c
parentlib: add module support to string tests (diff)
downloadwireguard-linux-dc2bf000a2848cf1dee373db14ce2cd1fe3ee394.tar.xz
wireguard-linux-dc2bf000a2848cf1dee373db14ce2cd1fe3ee394.zip
lib/test: delete five error messages for failed memory allocations
Omit extra messages for a memory allocation failure in these functions. This issue was detected by using the Coccinelle software. Link: http://lkml.kernel.org/r/410a4c5a-4ee0-6fcc-969c-103d8e496b78@users.sourceforge.net Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Acked-by: Michal Hocko <mhocko@suse.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/test_list_sort.c')
-rw-r--r--lib/test_list_sort.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/test_list_sort.c b/lib/test_list_sort.c
index 28e817387b04..5474f3f3e41d 100644
--- a/lib/test_list_sort.c
+++ b/lib/test_list_sort.c
@@ -76,17 +76,14 @@ static int __init list_sort_test(void)
pr_debug("start testing list_sort()\n");
elts = kcalloc(TEST_LIST_LEN, sizeof(*elts), GFP_KERNEL);
- if (!elts) {
- pr_err("error: cannot allocate memory\n");
+ if (!elts)
return err;
- }
for (i = 0; i < TEST_LIST_LEN; i++) {
el = kmalloc(sizeof(*el), GFP_KERNEL);
- if (!el) {
- pr_err("error: cannot allocate memory\n");
+ if (!el)
goto exit;
- }
+
/* force some equivalencies */
el->value = prandom_u32() % (TEST_LIST_LEN / 3);
el->serial = i;