[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250228141856.730825-1-eleanor15x@gmail.com>
Date: Fri, 28 Feb 2025 22:18:56 +0800
From: Yu-Chun Lin <eleanor15x@...il.com>
To: akpm@...ux-foundation.org
Cc: linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
jserv@...s.ncku.edu.tw,
visitorckw@...il.com,
Yu-Chun Lin <eleanor15x@...il.com>,
kernel test robot <lkp@...el.com>
Subject: [PATCH] mm/list_lru: Remove redundant NULL check before kfree()
The kernel's kfree() documentation states: "If @object is NULL, no
operation is performed." Remove checking for NULL before calling kfree().
Reported-by: kernel test robot <lkp@...el.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202502250720.9ueIb7Xh-lkp@intel.com/
Signed-off-by: Yu-Chun Lin <eleanor15x@...il.com>
---
mm/list_lru.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/mm/list_lru.c b/mm/list_lru.c
index 7d69434c70e0..7c8fb17d9027 100644
--- a/mm/list_lru.c
+++ b/mm/list_lru.c
@@ -548,8 +548,7 @@ int memcg_list_lru_alloc(struct mem_cgroup *memcg, struct list_lru *lru,
}
xas_unlock_irqrestore(&xas, flags);
} while (xas_nomem(&xas, gfp));
- if (mlru)
- kfree(mlru);
+ kfree(mlru);
} while (pos != memcg && !css_is_dying(&pos->css));
return xas_error(&xas);
--
2.43.0
Powered by blists - more mailing lists