diff options
| author | Markus Elfring <elfring@users.sourceforge.net> | 2017-11-17 18:28:00 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-17 19:10:01 -0500 |
| commit | dc2bf000a2848cf1dee373db14ce2cd1fe3ee394 (patch) | |
| tree | f3e52c19d108d51d0f8daa43a27235fce3a14ecf /lib | |
| parent | d6b28e0996962aeadd3777ae565ae03dd5c59f18 (diff) | |
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')
| -rw-r--r-- | lib/test_kasan.c | 5 | ||||
| -rw-r--r-- | lib/test_kmod.c | 8 | ||||
| -rw-r--r-- | lib/test_list_sort.c | 9 |
3 files changed, 7 insertions, 15 deletions
diff --git a/lib/test_kasan.c b/lib/test_kasan.c index a25c9763fce1..ef1a3ac1397e 100644 --- a/lib/test_kasan.c +++ b/lib/test_kasan.c | |||
| @@ -353,10 +353,9 @@ static noinline void __init memcg_accounted_kmem_cache(void) | |||
| 353 | */ | 353 | */ |
| 354 | for (i = 0; i < 5; i++) { | 354 | for (i = 0; i < 5; i++) { |
| 355 | p = kmem_cache_alloc(cache, GFP_KERNEL); | 355 | p = kmem_cache_alloc(cache, GFP_KERNEL); |
| 356 | if (!p) { | 356 | if (!p) |
| 357 | pr_err("Allocation failed\n"); | ||
| 358 | goto free_cache; | 357 | goto free_cache; |
| 359 | } | 358 | |
| 360 | kmem_cache_free(cache, p); | 359 | kmem_cache_free(cache, p); |
| 361 | msleep(100); | 360 | msleep(100); |
| 362 | } | 361 | } |
diff --git a/lib/test_kmod.c b/lib/test_kmod.c index fba78d25e825..337f408b4de6 100644 --- a/lib/test_kmod.c +++ b/lib/test_kmod.c | |||
| @@ -783,10 +783,8 @@ static int kmod_config_sync_info(struct kmod_test_device *test_dev) | |||
| 783 | free_test_dev_info(test_dev); | 783 | free_test_dev_info(test_dev); |
| 784 | test_dev->info = vzalloc(config->num_threads * | 784 | test_dev->info = vzalloc(config->num_threads * |
| 785 | sizeof(struct kmod_test_device_info)); | 785 | sizeof(struct kmod_test_device_info)); |
| 786 | if (!test_dev->info) { | 786 | if (!test_dev->info) |
| 787 | dev_err(test_dev->dev, "Cannot alloc test_dev info\n"); | ||
| 788 | return -ENOMEM; | 787 | return -ENOMEM; |
| 789 | } | ||
| 790 | 788 | ||
| 791 | return 0; | 789 | return 0; |
| 792 | } | 790 | } |
| @@ -1089,10 +1087,8 @@ static struct kmod_test_device *alloc_test_dev_kmod(int idx) | |||
| 1089 | struct miscdevice *misc_dev; | 1087 | struct miscdevice *misc_dev; |
| 1090 | 1088 | ||
| 1091 | test_dev = vzalloc(sizeof(struct kmod_test_device)); | 1089 | test_dev = vzalloc(sizeof(struct kmod_test_device)); |
| 1092 | if (!test_dev) { | 1090 | if (!test_dev) |
| 1093 | pr_err("Cannot alloc test_dev\n"); | ||
| 1094 | goto err_out; | 1091 | goto err_out; |
| 1095 | } | ||
| 1096 | 1092 | ||
| 1097 | mutex_init(&test_dev->config_mutex); | 1093 | mutex_init(&test_dev->config_mutex); |
| 1098 | mutex_init(&test_dev->trigger_mutex); | 1094 | mutex_init(&test_dev->trigger_mutex); |
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) | |||
| 76 | pr_debug("start testing list_sort()\n"); | 76 | pr_debug("start testing list_sort()\n"); |
| 77 | 77 | ||
| 78 | elts = kcalloc(TEST_LIST_LEN, sizeof(*elts), GFP_KERNEL); | 78 | elts = kcalloc(TEST_LIST_LEN, sizeof(*elts), GFP_KERNEL); |
| 79 | if (!elts) { | 79 | if (!elts) |
| 80 | pr_err("error: cannot allocate memory\n"); | ||
| 81 | return err; | 80 | return err; |
| 82 | } | ||
| 83 | 81 | ||
| 84 | for (i = 0; i < TEST_LIST_LEN; i++) { | 82 | for (i = 0; i < TEST_LIST_LEN; i++) { |
| 85 | el = kmalloc(sizeof(*el), GFP_KERNEL); | 83 | el = kmalloc(sizeof(*el), GFP_KERNEL); |
| 86 | if (!el) { | 84 | if (!el) |
| 87 | pr_err("error: cannot allocate memory\n"); | ||
| 88 | goto exit; | 85 | goto exit; |
| 89 | } | 86 | |
| 90 | /* force some equivalencies */ | 87 | /* force some equivalencies */ |
| 91 | el->value = prandom_u32() % (TEST_LIST_LEN / 3); | 88 | el->value = prandom_u32() % (TEST_LIST_LEN / 3); |
| 92 | el->serial = i; | 89 | el->serial = i; |
