mm/hugetlb: simplify the calculation of variables
authorJiapeng Zhong <abaci-bugfix@linux.alibaba.com>
Wed, 24 Feb 2021 20:07:09 +0000 (12:07 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 24 Feb 2021 21:38:32 +0000 (13:38 -0800)
Fix the following coccicheck warnings:

  mm/hugetlb.c:3372:20-22: WARNING !A || A && B is equivalent to !A || B.

Link: https://lkml.kernel.org/r/1611643468-52233-1-git-send-email-abaci-bugfix@linux.alibaba.com
Signed-off-by: Jiapeng Zhong <abaci-bugfix@linux.alibaba.com>
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/hugetlb.c

index e8d39b0fe4bd1b7c9375ddbba29e23dabf8a845d..6920c71d7e0de6d4d982f20058b367776da42919 100644 (file)
@@ -3420,8 +3420,7 @@ static unsigned int allowed_mems_nr(struct hstate *h)
        mpol_allowed = policy_nodemask_current(gfp_mask);
 
        for_each_node_mask(node, cpuset_current_mems_allowed) {
-               if (!mpol_allowed ||
-                   (mpol_allowed && node_isset(node, *mpol_allowed)))
+               if (!mpol_allowed || node_isset(node, *mpol_allowed))
                        nr += array[node];
        }