mm/memcontrol: remove redundant NULL check
authorYang Li <abaci-bugfix@linux.alibaba.com>
Wed, 24 Feb 2021 20:04:05 +0000 (12:04 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 24 Feb 2021 21:38:29 +0000 (13:38 -0800)
Fix below warnings reported by coccicheck:

  mm/memcontrol.c:451:3-9: WARNING: NULL check before some freeing functions is not needed.

Link: https://lkml.kernel.org/r/1611216029-34397-1-git-send-email-abaci-bugfix@linux.alibaba.com
Signed-off-by: Yang Li <abaci-bugfix@linux.alibaba.com>
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/memcontrol.c

index dce5291525a5d65bf7b32c06bdb9b8fa7432a5dc..ed5cc78a8dbfb28b65dc7ab9ef0a7e8fced558c8 100644 (file)
@@ -452,8 +452,7 @@ static void memcg_free_shrinker_maps(struct mem_cgroup *memcg)
        for_each_node(nid) {
                pn = mem_cgroup_nodeinfo(memcg, nid);
                map = rcu_dereference_protected(pn->shrinker_map, true);
-               if (map)
-                       kvfree(map);
+               kvfree(map);
                rcu_assign_pointer(pn->shrinker_map, NULL);
        }
 }