All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li zeming <zeming@nfschina.com>
To: akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Li zeming <zeming@nfschina.com>
Subject: [PATCH] mm: mempool: Optimize the mempool_create_node function
Date: Thu, 16 Mar 2023 03:12:43 +0800	[thread overview]
Message-ID: <20230315191243.3289-1-zeming@nfschina.com> (raw)

The pool pointer variable gets the kzalloc_node function return value
directly at definition time, which should be more concise.

Signed-off-by: Li zeming <zeming@nfschina.com>
---
 mm/mempool.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/mm/mempool.c b/mm/mempool.c
index 734bcf5afbb7..9a4db6efc9ab 100644
--- a/mm/mempool.c
+++ b/mm/mempool.c
@@ -267,9 +267,7 @@ mempool_t *mempool_create_node(int min_nr, mempool_alloc_t *alloc_fn,
 			       mempool_free_t *free_fn, void *pool_data,
 			       gfp_t gfp_mask, int node_id)
 {
-	mempool_t *pool;
-
-	pool = kzalloc_node(sizeof(*pool), gfp_mask, node_id);
+	mempool_t *pool = kzalloc_node(sizeof(*pool), gfp_mask, node_id);
 	if (!pool)
 		return NULL;
 
-- 
2.18.2


             reply	other threads:[~2023-03-14  2:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-15 19:12 Li zeming [this message]
2023-03-15 17:53 ` [PATCH] mm: mempool: Optimize the mempool_create_node function Florian Fainelli

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=20230315191243.3289-1-zeming@nfschina.com \
    --to=zeming@nfschina.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.