Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc: Use NULL instead of 0 for null pointers

Sparse reports several uses of 0 for pointer arguments and comparisons.
Replace with NULL to better convey the intent. Remove entirely if a
comparison to follow the kernel style of implicit boolean conversions.

Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20231011053711.93427-5-bgray@linux.ibm.com

authored by

Benjamin Gray and committed by
Michael Ellerman
ddfb7d9d 340a60e3

+10 -10
+1 -1
arch/powerpc/kernel/setup_64.c
··· 364 364 */ 365 365 initialise_paca(&boot_paca, 0); 366 366 fixup_boot_paca(&boot_paca); 367 - WARN_ON(local_paca != 0); 367 + WARN_ON(local_paca); 368 368 setup_paca(&boot_paca); /* install the paca into registers */ 369 369 370 370 /* -------- printk is now safe to use ------- */
+1 -1
arch/powerpc/kvm/book3s_xive_native.c
··· 567 567 u8 priority; 568 568 struct kvm_ppc_xive_eq kvm_eq; 569 569 int rc; 570 - __be32 *qaddr = 0; 570 + __be32 *qaddr = NULL; 571 571 struct page *page; 572 572 struct xive_q *q; 573 573 gfn_t gfn;
+2 -2
arch/powerpc/net/bpf_jit_comp.c
··· 146 146 * update ctgtx.idx as it pretends to output instructions, then we can 147 147 * calculate total size from idx. 148 148 */ 149 - bpf_jit_build_prologue(0, &cgctx); 149 + bpf_jit_build_prologue(NULL, &cgctx); 150 150 addrs[fp->len] = cgctx.idx * 4; 151 - bpf_jit_build_epilogue(0, &cgctx); 151 + bpf_jit_build_epilogue(NULL, &cgctx); 152 152 153 153 fixup_len = fp->aux->num_exentries * BPF_FIXUP_LEN * 4; 154 154 extable_len = fp->aux->num_exentries * sizeof(struct exception_table_entry);
+1 -1
arch/powerpc/perf/imc-pmu.c
··· 544 544 break; 545 545 } 546 546 pcni++; 547 - } while (pcni->vbase != 0); 547 + } while (pcni->vbase); 548 548 549 549 if (!flag) 550 550 return -ENODEV;
+1 -1
arch/powerpc/platforms/4xx/soc.c
··· 112 112 } 113 113 114 114 /* Install error handler */ 115 - if (request_irq(irq, l2c_error_handler, 0, "L2C", 0) < 0) { 115 + if (request_irq(irq, l2c_error_handler, 0, "L2C", NULL) < 0) { 116 116 printk(KERN_ERR "Cannot install L2C error handler" 117 117 ", cache is not enabled\n"); 118 118 of_node_put(np);
+4 -4
arch/powerpc/platforms/pseries/lpar.c
··· 192 192 continue; 193 193 kmem_cache_free(dtl_cache, pp->dispatch_log); 194 194 pp->dtl_ridx = 0; 195 - pp->dispatch_log = 0; 196 - pp->dispatch_log_end = 0; 197 - pp->dtl_curr = 0; 195 + pp->dispatch_log = NULL; 196 + pp->dispatch_log_end = NULL; 197 + pp->dtl_curr = NULL; 198 198 199 199 if (time_limit && time_after(jiffies, *time_limit)) { 200 200 cond_resched(); ··· 223 223 { 224 224 kfree(vcpu_associativity); 225 225 kfree(pcpu_associativity); 226 - vcpu_associativity = pcpu_associativity = 0; 226 + vcpu_associativity = pcpu_associativity = NULL; 227 227 } 228 228 229 229 static __be32 *__get_cpu_associativity(int cpu, __be32 *cpu_assoc, int flag)