[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tencent_0B119ADC0E546990F05E3727AB7364AEAB08@qq.com>
Date: Thu, 27 Feb 2025 14:10:02 +0800
From: xiaopeitux@...mail.com
To: linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
akpm@...ux-foundation.org
Cc: Pei Xiao <xiaopei01@...inos.cn>
Subject: [PATCH] mm/list_lru: Remove unnecessary NULL check before kfree()
From: Pei Xiao <xiaopei01@...inos.cn>
Since kfree() already checks if its argument is NULL, an additional
check before calling kfree() is unnecessary and can be removed.
Remove it and thus also the following cocci warning:
WARNING: NULL check before some freeing functions is not needed.
Signed-off-by: Pei Xiao <xiaopei01@...inos.cn>
---
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.25.1
Powered by blists - more mailing lists