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

powerpc: Fix a number of sparse warnings

Address some of the trivial sparse warnings in arch/powerpc.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

authored by

Anton Blanchard and committed by
Benjamin Herrenschmidt
b0d436c7 a0a96ee9

+20 -20
+1 -1
arch/powerpc/kernel/legacy_serial.c
··· 99 99 legacy_serial_count = index + 1; 100 100 101 101 /* Check if there is a port who already claimed our slot */ 102 - if (legacy_serial_infos[index].np != 0) { 102 + if (legacy_serial_infos[index].np != NULL) { 103 103 /* if we still have some room, move it, else override */ 104 104 if (legacy_serial_count < MAX_LEGACY_SERIAL_PORTS) { 105 105 printk(KERN_DEBUG "Moved legacy port %d -> %d\n",
+2 -2
arch/powerpc/kernel/pci-common.c
··· 306 306 unsigned long io_offset = 0; 307 307 int i, res_bit; 308 308 309 - if (hose == 0) 309 + if (hose == NULL) 310 310 return NULL; /* should never happen */ 311 311 312 312 /* If memory, add on the PCI bridge address offset */ ··· 1578 1578 { 1579 1579 static struct pci_bus bus; 1580 1580 1581 - if (hose == 0) { 1581 + if (hose == NULL) { 1582 1582 printk(KERN_ERR "Can't find hose for PCI bus %d!\n", busnr); 1583 1583 } 1584 1584 bus.number = busnr;
+1 -1
arch/powerpc/kernel/pci_64.c
··· 109 109 hose = pci_bus_to_host(bus); 110 110 111 111 /* Check if we have IOs allocated */ 112 - if (hose->io_base_alloc == 0) 112 + if (hose->io_base_alloc == NULL) 113 113 return 0; 114 114 115 115 pr_debug("IO unmapping for PHB %s\n", hose->dn->full_name);
+2 -2
arch/powerpc/kernel/setup_64.c
··· 325 325 NULL); 326 326 if (lsizep != NULL) 327 327 lsize = *lsizep; 328 - if (sizep == 0 || lsizep == 0) 328 + if (sizep == NULL || lsizep == NULL) 329 329 DBG("Argh, can't find dcache properties ! " 330 330 "sizep: %p, lsizep: %p\n", sizep, lsizep); 331 331 ··· 347 347 NULL); 348 348 if (lsizep != NULL) 349 349 lsize = *lsizep; 350 - if (sizep == 0 || lsizep == 0) 350 + if (sizep == NULL || lsizep == NULL) 351 351 DBG("Argh, can't find icache properties ! " 352 352 "sizep: %p, lsizep: %p\n", sizep, lsizep); 353 353
+4 -4
arch/powerpc/kernel/signal_64.c
··· 346 346 if (v_regs && !access_ok(VERIFY_READ, v_regs, 34 * sizeof(vector128))) 347 347 return -EFAULT; 348 348 /* Copy 33 vec registers (vr0..31 and vscr) from the stack */ 349 - if (v_regs != 0 && (msr & MSR_VEC) != 0) 349 + if (v_regs != NULL && (msr & MSR_VEC) != 0) 350 350 err |= __copy_from_user(current->thread.vr, v_regs, 351 351 33 * sizeof(vector128)); 352 352 else if (current->thread.used_vr) 353 353 memset(current->thread.vr, 0, 33 * sizeof(vector128)); 354 354 /* Always get VRSAVE back */ 355 - if (v_regs != 0) 355 + if (v_regs != NULL) 356 356 err |= __get_user(current->thread.vrsave, (u32 __user *)&v_regs[33]); 357 357 else 358 358 current->thread.vrsave = 0; ··· 463 463 tm_v_regs, 34 * sizeof(vector128))) 464 464 return -EFAULT; 465 465 /* Copy 33 vec registers (vr0..31 and vscr) from the stack */ 466 - if (v_regs != 0 && tm_v_regs != 0 && (msr & MSR_VEC) != 0) { 466 + if (v_regs != NULL && tm_v_regs != NULL && (msr & MSR_VEC) != 0) { 467 467 err |= __copy_from_user(current->thread.vr, v_regs, 468 468 33 * sizeof(vector128)); 469 469 err |= __copy_from_user(current->thread.transact_vr, tm_v_regs, ··· 474 474 memset(current->thread.transact_vr, 0, 33 * sizeof(vector128)); 475 475 } 476 476 /* Always get VRSAVE back */ 477 - if (v_regs != 0 && tm_v_regs != 0) { 477 + if (v_regs != NULL && tm_v_regs != NULL) { 478 478 err |= __get_user(current->thread.vrsave, 479 479 (u32 __user *)&v_regs[33]); 480 480 err |= __get_user(current->thread.transact_vrsave,
+1 -1
arch/powerpc/kernel/smp.c
··· 172 172 #endif 173 173 err = request_irq(virq, smp_ipi_action[msg], 174 174 IRQF_PERCPU | IRQF_NO_THREAD | IRQF_NO_SUSPEND, 175 - smp_ipi_name[msg], 0); 175 + smp_ipi_name[msg], NULL); 176 176 WARN(err < 0, "unable to request_irq %d for %s (rc %d)\n", 177 177 virq, smp_ipi_name[msg], err); 178 178
+1 -1
arch/powerpc/mm/hash_utils_64.c
··· 907 907 908 908 if (ea >= spt->maxaddr) 909 909 return 0; 910 - if (ea < 0x100000000) { 910 + if (ea < 0x100000000UL) { 911 911 /* addresses below 4GB use spt->low_prot */ 912 912 sbpm = spt->low_prot; 913 913 } else {
+2 -2
arch/powerpc/mm/subpage-prot.c
··· 105 105 limit = spt->maxaddr; 106 106 for (; addr < limit; addr = next) { 107 107 next = pmd_addr_end(addr, limit); 108 - if (addr < 0x100000000) { 108 + if (addr < 0x100000000UL) { 109 109 spm = spt->low_prot; 110 110 } else { 111 111 spm = spt->protptrs[addr >> SBP_L3_SHIFT]; ··· 219 219 for (limit = addr + len; addr < limit; addr = next) { 220 220 next = pmd_addr_end(addr, limit); 221 221 err = -ENOMEM; 222 - if (addr < 0x100000000) { 222 + if (addr < 0x100000000UL) { 223 223 spm = spt->low_prot; 224 224 } else { 225 225 spm = spt->protptrs[addr >> SBP_L3_SHIFT];
+1 -1
arch/powerpc/perf/core-book3s.c
··· 24 24 #define BHRB_MAX_ENTRIES 32 25 25 #define BHRB_TARGET 0x0000000000000002 26 26 #define BHRB_PREDICTION 0x0000000000000001 27 - #define BHRB_EA 0xFFFFFFFFFFFFFFFC 27 + #define BHRB_EA 0xFFFFFFFFFFFFFFFCUL 28 28 29 29 struct cpu_hw_events { 30 30 int n_events;
+1 -1
arch/powerpc/platforms/powernv/opal.c
··· 422 422 423 423 for (i = 0; i < opal_irq_count; i++) { 424 424 if (opal_irqs[i]) 425 - free_irq(opal_irqs[i], 0); 425 + free_irq(opal_irqs[i], NULL); 426 426 opal_irqs[i] = 0; 427 427 } 428 428 }
+1 -1
arch/powerpc/platforms/pseries/lpar.c
··· 724 724 725 725 mpp_data->mem_weight = (retbuf[3] >> 7 * 8) & 0xff; 726 726 mpp_data->unallocated_mem_weight = (retbuf[3] >> 6 * 8) & 0xff; 727 - mpp_data->unallocated_entitlement = retbuf[3] & 0xffffffffffff; 727 + mpp_data->unallocated_entitlement = retbuf[3] & 0xffffffffffffUL; 728 728 729 729 mpp_data->pool_size = retbuf[4]; 730 730 mpp_data->loan_request = retbuf[5];
+2 -2
arch/powerpc/platforms/pseries/pseries_energy.c
··· 108 108 * energy consumption. 109 109 */ 110 110 111 - #define FLAGS_MODE1 0x004E200000080E01 112 - #define FLAGS_MODE2 0x004E200000080401 111 + #define FLAGS_MODE1 0x004E200000080E01UL 112 + #define FLAGS_MODE2 0x004E200000080401UL 113 113 #define FLAGS_ACTIVATE 0x100 114 114 115 115 static ssize_t get_best_energy_list(char *page, int activate)
+1 -1
arch/powerpc/platforms/pseries/setup.c
··· 183 183 np = of_find_node_by_path("/"); 184 184 naddr = of_n_addr_cells(np); 185 185 opprop = of_get_property(np, "platform-open-pic", &opplen); 186 - if (opprop != 0) { 186 + if (opprop != NULL) { 187 187 openpic_addr = of_read_number(opprop, naddr); 188 188 printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr); 189 189 }