linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chen Jun <chenjun102@huawei.com>
To: <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>
Cc: <catalin.marinas@arm.com>, <akpm@linux-foundation.org>,
	<rui.xiang@huawei.com>, <weiyongjun1@huawei.com>
Subject: [PATCH -next 1/5] mm/kmemleak: make create_object return void
Date: Mon, 21 Sep 2020 02:00:03 +0000	[thread overview]
Message-ID: <20200921020007.35803-2-chenjun102@huawei.com> (raw)
In-Reply-To: <20200921020007.35803-1-chenjun102@huawei.com>

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(-)

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;
 }
 
 /*
-- 
2.25.0


  reply	other threads:[~2020-09-21  2:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-21  2:00 [PATCH -next 0/5] mm/kmemleak:support for percpu memory leak detect Chen Jun
2020-09-21  2:00 ` Chen Jun [this message]
2020-09-22  9:57   ` [PATCH -next 1/5] mm/kmemleak: make create_object return void Catalin Marinas
2020-09-21  2:00 ` [PATCH -next 2/5] mm/kmemleak: skip update_checksum for OBJECT_NO_SCAN objects Chen Jun
2020-09-22  9:03   ` Catalin Marinas
2020-09-21  2:00 ` [PATCH -next 3/5] mm/kmemleak: Add support for percpu memory leak detect Chen Jun
2020-09-22  9:57   ` Catalin Marinas
2020-09-28 14:08     ` chenjun (AM)
2020-09-28 14:16       ` Catalin Marinas
2020-09-21  2:00 ` [PATCH -next 4/5] mm/kmemleak-test: use %px instead of %p in print Chen Jun
2020-09-22  9:58   ` Catalin Marinas
2020-09-21  2:00 ` [PATCH -next 5/5] mm/kmemleak-test: Add a test case for alloc_percpu Chen Jun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200921020007.35803-2-chenjun102@huawei.com \
    --to=chenjun102@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rui.xiang@huawei.com \
    --cc=weiyongjun1@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).