kernel/profile.c: use cpumask_available to check for NULL cpumask 64/292564/1
authorNathan Chancellor <natechancellor@gmail.com>
Thu, 5 Dec 2019 00:50:50 +0000 (16:50 -0800)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Mon, 8 May 2023 09:35:55 +0000 (18:35 +0900)
commit0cdcf5007f495169e7f256c8b1723936162ca574
tree8f092de42c2ad89ec4c8003e37d5f201470b1540
parent319aa01dcede71214b4ed13a838ac70468f54d61
kernel/profile.c: use cpumask_available to check for NULL cpumask

When building with clang + -Wtautological-pointer-compare, these
instances pop up:

  kernel/profile.c:339:6: warning: comparison of array 'prof_cpu_mask' not equal to a null pointer is always true [-Wtautological-pointer-compare]
          if (prof_cpu_mask != NULL)
              ^~~~~~~~~~~~~    ~~~~
  kernel/profile.c:376:6: warning: comparison of array 'prof_cpu_mask' not equal to a null pointer is always true [-Wtautological-pointer-compare]
          if (prof_cpu_mask != NULL)
              ^~~~~~~~~~~~~    ~~~~
  kernel/profile.c:406:26: warning: comparison of array 'prof_cpu_mask' not equal to a null pointer is always true [-Wtautological-pointer-compare]
          if (!user_mode(regs) && prof_cpu_mask != NULL &&
                                ^~~~~~~~~~~~~    ~~~~
  3 warnings generated.

This can be addressed with the cpumask_available helper, introduced in
commit f7e30f01a9e2 ("cpumask: Add helper cpumask_available()") to fix
warnings like this while keeping the code the same.

Link: https://github.com/ClangBuiltLinux/linux/issues/747
Link: http://lkml.kernel.org/r/20191022191957.9554-1-natechancellor@gmail.com
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[sw0312.kim: backport upstream commit ef70eff9dea6 to resolve gcc-12 build issue]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Ifbe97caa3ee7b2db0f071ba036218db7fe5a58fd
kernel/profile.c