diff mbox series

[-next,1/5] mm/kmemleak: make create_object return void

Message ID 20200921020007.35803-2-chenjun102@huawei.com
State New
Headers show
Series mm/kmemleak´╝Üsupport for percpu memory leak detect | expand

Commit Message

chenjun (AM) Sept. 21, 2020, 2 a.m. UTC
From: Wei Yongjun <weiyongjun1@huawei.com>

No user cares about the return value of create_object,
so make it return void.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Chen Jun <chenjun102@huawei.com>
---
 mm/kmemleak.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Catalin Marinas Sept. 22, 2020, 9:57 a.m. UTC | #1
On Mon, Sep 21, 2020 at 02:00:03AM +0000, Chen Jun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> No user cares about the return value of create_object,
> so make it return void.
> 
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> Signed-off-by: Chen Jun <chenjun102@huawei.com>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
diff mbox series

Patch

diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index c0014d3b91c1..b3f603fd9fc3 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -567,8 +567,8 @@  static int __save_stack_trace(unsigned long *trace)
  * Create the metadata (struct kmemleak_object) corresponding to an allocated
  * memory block and add it to the object_list and object_tree_root.
  */
-static struct kmemleak_object *create_object(unsigned long ptr, size_t size,
-					     int min_count, gfp_t gfp)
+static void create_object(unsigned long ptr, size_t size, int min_count,
+			  gfp_t gfp)
 {
 	unsigned long flags;
 	struct kmemleak_object *object, *parent;
@@ -579,7 +579,7 @@  static struct kmemleak_object *create_object(unsigned long ptr, size_t size,
 	if (!object) {
 		pr_warn("Cannot allocate a kmemleak_object structure\n");
 		kmemleak_disable();
-		return NULL;
+		return;
 	}
 
 	INIT_LIST_HEAD(&object->object_list);
@@ -640,7 +640,6 @@  static struct kmemleak_object *create_object(unsigned long ptr, size_t size,
 			 */
 			dump_object_info(parent);
 			kmem_cache_free(object_cache, object);
-			object = NULL;
 			goto out;
 		}
 	}
@@ -650,7 +649,6 @@  static struct kmemleak_object *create_object(unsigned long ptr, size_t size,
 	list_add_tail_rcu(&object->object_list, &object_list);
 out:
 	raw_spin_unlock_irqrestore(&kmemleak_lock, flags);
-	return object;
 }
 
 /*