selftests/mm: fix WARNING comparing pointer to 0
authorAnh Tuan Phan <tuananhlfc@gmail.com>
Thu, 17 Aug 2023 16:00:33 +0000 (23:00 +0700)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 24 Aug 2023 23:20:27 +0000 (16:20 -0700)
Remove comparing pointer to 0 to avoid this warning from coccinelle:

./tools/testing/selftests/mm/map_populate.c:80:16-17: WARNING comparing pointer to 0, suggest !E
./tools/testing/selftests/mm/map_populate.c:80:16-17: WARNING comparing pointer to 0

Link: https://lkml.kernel.org/r/20230817160033.90079-1-tuananhlfc@gmail.com
Signed-off-by: Anh Tuan Phan <tuananhlfc@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/mm/map_populate.c

index 240f2d9..7945d07 100644 (file)
@@ -77,7 +77,7 @@ int main(int argc, char **argv)
        unsigned long *smap;
 
        ftmp = tmpfile();
-       BUG_ON(ftmp == 0, "tmpfile()");
+       BUG_ON(!ftmp, "tmpfile()");
 
        ret = ftruncate(fileno(ftmp), MMAP_SZ);
        BUG_ON(ret, "ftruncate()");