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.
Unified · Split
| @@ -336,7 +336,7 @@ static int profile_dead_cpu(unsigned int cpu) · 335 unmodified lines | |||
| 336 | struct page *page; | 336 | struct page *page; |
| 337 | int i; | 337 | int i; |
| 338 | 338 | ||
| 339 | if (prof_cpu_mask != NULL) | 339 | if (cpumask_available(prof_cpu_mask)) |
| 340 | cpumask_clear_cpu(cpu, prof_cpu_mask); | 340 | cpumask_clear_cpu(cpu, prof_cpu_mask); |
| 341 | 341 | ||
| 342 | for (i = 0; i < 2; i++) { | 342 | for (i = 0; i < 2; i++) { |
| @@ -373,7 +373,7 @@ static int profile_prepare_cpu(unsigned int cpu) · 30 unmodified lines | |||
| 373 | 373 | ||
| 374 | static int profile_online_cpu(unsigned int cpu) | 374 | static int profile_online_cpu(unsigned int cpu) |
| 375 | { | 375 | { |
| 376 | if (prof_cpu_mask != NULL) | 376 | if (cpumask_available(prof_cpu_mask)) |
| 377 | cpumask_set_cpu(cpu, prof_cpu_mask); | 377 | cpumask_set_cpu(cpu, prof_cpu_mask); |
| 378 | 378 | ||
| 379 | return 0; | 379 | return 0; |
| @@ -403,7 +403,7 @@ void profile_tick(int type) · 23 unmodified lines | |||
| 403 | { | 403 | { |
| 404 | struct pt_regs *regs = get_irq_regs(); | 404 | struct pt_regs *regs = get_irq_regs(); |
| 405 | 405 | ||
| 406 | if (!user_mode(regs) && prof_cpu_mask != NULL && | 406 | if (!user_mode(regs) && cpumask_available(prof_cpu_mask) && |
| 407 | cpumask_test_cpu(smp_processor_id(), prof_cpu_mask)) | 407 | cpumask_test_cpu(smp_processor_id(), prof_cpu_mask)) |
| 408 | profile_hit(type, (void *)profile_pc(regs)); | 408 | profile_hit(type, (void *)profile_pc(regs)); |
| 409 | } | 409 | } |