From 309167b966b61c2aef2c268c4a0c25334d6310bd Mon Sep 17 00:00:00 2001 From: Aishwarya Pant Date: Tue, 17 Oct 2017 09:14:47 -0400 Subject: media: staging: atomisp: cleanup out of memory messages Logging of explicit out of memory messages is redundant since memory allocation failures produce a backtrace. Done with the help of the following cocci script: @@ expression ex, ret; statement s; constant char[] c; constant err; identifier f, l; @@ ex = \(kmalloc\|kmalloc_array\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\| kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\|devm_kzalloc\)(...) ... when != ex if ( ( !ex | unlikely(!ex) ) ) - { - f(..., c, ...); ( return ex; | return; | return err; | goto l; ) - } else s Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_dynamic_pool.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_dynamic_pool.c') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_dynamic_pool.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_dynamic_pool.c index 19e0e9ee37de..eb82c3e4c776 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_dynamic_pool.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_dynamic_pool.c @@ -116,8 +116,6 @@ static void free_pages_to_dynamic_pool(void *pool, hmm_page = kmem_cache_zalloc(dypool_info->pgptr_cache, GFP_KERNEL); if (!hmm_page) { - dev_err(atomisp_dev, "out of memory for hmm_page.\n"); - /* free page directly */ ret = set_pages_wb(page_obj->page, 1); if (ret) @@ -151,10 +149,8 @@ static int hmm_dynamic_pool_init(void **pool, unsigned int pool_size) dypool_info = kmalloc(sizeof(struct hmm_dynamic_pool_info), GFP_KERNEL); - if (unlikely(!dypool_info)) { - dev_err(atomisp_dev, "out of memory for repool_info.\n"); + if (unlikely(!dypool_info)) return -ENOMEM; - } dypool_info->pgptr_cache = kmem_cache_create("pgptr_cache", sizeof(struct hmm_page), 0, -- cgit v1.2.3