Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF4EEC61DA4 for ; Tue, 14 Mar 2023 02:41:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229785AbjCNCl2 (ORCPT ); Mon, 13 Mar 2023 22:41:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229475AbjCNCl0 (ORCPT ); Mon, 13 Mar 2023 22:41:26 -0400 Received: from mail.nfschina.com (unknown [42.101.60.237]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE21683890 for ; Mon, 13 Mar 2023 19:41:25 -0700 (PDT) Received: from localhost (unknown [127.0.0.1]) by mail.nfschina.com (Postfix) with ESMTP id 869141A00A24; Tue, 14 Mar 2023 10:42:16 +0800 (CST) X-Virus-Scanned: amavisd-new at nfschina.com Received: from mail.nfschina.com ([127.0.0.1]) by localhost (localhost.localdomain [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id y9sF5mFJskeq; Tue, 14 Mar 2023 10:42:15 +0800 (CST) Received: from localhost.localdomain (unknown [219.141.250.2]) (Authenticated sender: zeming@nfschina.com) by mail.nfschina.com (Postfix) with ESMTPA id A8B791A0099A; Tue, 14 Mar 2023 10:42:15 +0800 (CST) From: Li zeming To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Li zeming Subject: [PATCH] mm: mempool: Optimize the mempool_create_node function Date: Thu, 16 Mar 2023 03:12:43 +0800 Message-Id: <20230315191243.3289-1-zeming@nfschina.com> X-Mailer: git-send-email 2.18.2 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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