mm: memcontrol: remove unnecessary NULL check before free_percpu()
authorChen Ni <nichen@iscas.ac.cn>
Thu, 17 Apr 2025 08:43:30 +0000 (16:43 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 12 May 2025 00:48:34 +0000 (17:48 -0700)
free_percpu() checks for NULL pointers internally.  Remove unneeded NULL
check here.

Link: https://lkml.kernel.org/r/20250417084330.937380-1-nichen@iscas.ac.cn
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/memcontrol-v1.c

index 4a9cf27a70af053bd9967265135877f08add2c58..54c49cbfc968c0c156d58cf8a9c1aa2245e36a87 100644 (file)
@@ -2198,8 +2198,7 @@ bool memcg1_alloc_events(struct mem_cgroup *memcg)
 
 void memcg1_free_events(struct mem_cgroup *memcg)
 {
-       if (memcg->events_percpu)
-               free_percpu(memcg->events_percpu);
+       free_percpu(memcg->events_percpu);
 }
 
 static int __init memcg1_init(void)