Commit b0d436c7 authored by Anton Blanchard's avatar Anton Blanchard Committed by Benjamin Herrenschmidt

powerpc: Fix a number of sparse warnings

Address some of the trivial sparse warnings in arch/powerpc.
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent a0a96ee9
...@@ -99,7 +99,7 @@ static int __init add_legacy_port(struct device_node *np, int want_index, ...@@ -99,7 +99,7 @@ static int __init add_legacy_port(struct device_node *np, int want_index,
legacy_serial_count = index + 1; legacy_serial_count = index + 1;
/* Check if there is a port who already claimed our slot */ /* Check if there is a port who already claimed our slot */
if (legacy_serial_infos[index].np != 0) { if (legacy_serial_infos[index].np != NULL) {
/* if we still have some room, move it, else override */ /* if we still have some room, move it, else override */
if (legacy_serial_count < MAX_LEGACY_SERIAL_PORTS) { if (legacy_serial_count < MAX_LEGACY_SERIAL_PORTS) {
printk(KERN_DEBUG "Moved legacy port %d -> %d\n", printk(KERN_DEBUG "Moved legacy port %d -> %d\n",
......
...@@ -306,7 +306,7 @@ static struct resource *__pci_mmap_make_offset(struct pci_dev *dev, ...@@ -306,7 +306,7 @@ static struct resource *__pci_mmap_make_offset(struct pci_dev *dev,
unsigned long io_offset = 0; unsigned long io_offset = 0;
int i, res_bit; int i, res_bit;
if (hose == 0) if (hose == NULL)
return NULL; /* should never happen */ return NULL; /* should never happen */
/* If memory, add on the PCI bridge address offset */ /* If memory, add on the PCI bridge address offset */
...@@ -1578,7 +1578,7 @@ fake_pci_bus(struct pci_controller *hose, int busnr) ...@@ -1578,7 +1578,7 @@ fake_pci_bus(struct pci_controller *hose, int busnr)
{ {
static struct pci_bus bus; static struct pci_bus bus;
if (hose == 0) { if (hose == NULL) {
printk(KERN_ERR "Can't find hose for PCI bus %d!\n", busnr); printk(KERN_ERR "Can't find hose for PCI bus %d!\n", busnr);
} }
bus.number = busnr; bus.number = busnr;
......
...@@ -109,7 +109,7 @@ int pcibios_unmap_io_space(struct pci_bus *bus) ...@@ -109,7 +109,7 @@ int pcibios_unmap_io_space(struct pci_bus *bus)
hose = pci_bus_to_host(bus); hose = pci_bus_to_host(bus);
/* Check if we have IOs allocated */ /* Check if we have IOs allocated */
if (hose->io_base_alloc == 0) if (hose->io_base_alloc == NULL)
return 0; return 0;
pr_debug("IO unmapping for PHB %s\n", hose->dn->full_name); pr_debug("IO unmapping for PHB %s\n", hose->dn->full_name);
......
...@@ -325,7 +325,7 @@ static void __init initialize_cache_info(void) ...@@ -325,7 +325,7 @@ static void __init initialize_cache_info(void)
NULL); NULL);
if (lsizep != NULL) if (lsizep != NULL)
lsize = *lsizep; lsize = *lsizep;
if (sizep == 0 || lsizep == 0) if (sizep == NULL || lsizep == NULL)
DBG("Argh, can't find dcache properties ! " DBG("Argh, can't find dcache properties ! "
"sizep: %p, lsizep: %p\n", sizep, lsizep); "sizep: %p, lsizep: %p\n", sizep, lsizep);
...@@ -347,7 +347,7 @@ static void __init initialize_cache_info(void) ...@@ -347,7 +347,7 @@ static void __init initialize_cache_info(void)
NULL); NULL);
if (lsizep != NULL) if (lsizep != NULL)
lsize = *lsizep; lsize = *lsizep;
if (sizep == 0 || lsizep == 0) if (sizep == NULL || lsizep == NULL)
DBG("Argh, can't find icache properties ! " DBG("Argh, can't find icache properties ! "
"sizep: %p, lsizep: %p\n", sizep, lsizep); "sizep: %p, lsizep: %p\n", sizep, lsizep);
......
...@@ -346,13 +346,13 @@ static long restore_sigcontext(struct pt_regs *regs, sigset_t *set, int sig, ...@@ -346,13 +346,13 @@ static long restore_sigcontext(struct pt_regs *regs, sigset_t *set, int sig,
if (v_regs && !access_ok(VERIFY_READ, v_regs, 34 * sizeof(vector128))) if (v_regs && !access_ok(VERIFY_READ, v_regs, 34 * sizeof(vector128)))
return -EFAULT; return -EFAULT;
/* Copy 33 vec registers (vr0..31 and vscr) from the stack */ /* Copy 33 vec registers (vr0..31 and vscr) from the stack */
if (v_regs != 0 && (msr & MSR_VEC) != 0) if (v_regs != NULL && (msr & MSR_VEC) != 0)
err |= __copy_from_user(current->thread.vr, v_regs, err |= __copy_from_user(current->thread.vr, v_regs,
33 * sizeof(vector128)); 33 * sizeof(vector128));
else if (current->thread.used_vr) else if (current->thread.used_vr)
memset(current->thread.vr, 0, 33 * sizeof(vector128)); memset(current->thread.vr, 0, 33 * sizeof(vector128));
/* Always get VRSAVE back */ /* Always get VRSAVE back */
if (v_regs != 0) if (v_regs != NULL)
err |= __get_user(current->thread.vrsave, (u32 __user *)&v_regs[33]); err |= __get_user(current->thread.vrsave, (u32 __user *)&v_regs[33]);
else else
current->thread.vrsave = 0; current->thread.vrsave = 0;
...@@ -463,7 +463,7 @@ static long restore_tm_sigcontexts(struct pt_regs *regs, ...@@ -463,7 +463,7 @@ static long restore_tm_sigcontexts(struct pt_regs *regs,
tm_v_regs, 34 * sizeof(vector128))) tm_v_regs, 34 * sizeof(vector128)))
return -EFAULT; return -EFAULT;
/* Copy 33 vec registers (vr0..31 and vscr) from the stack */ /* Copy 33 vec registers (vr0..31 and vscr) from the stack */
if (v_regs != 0 && tm_v_regs != 0 && (msr & MSR_VEC) != 0) { if (v_regs != NULL && tm_v_regs != NULL && (msr & MSR_VEC) != 0) {
err |= __copy_from_user(current->thread.vr, v_regs, err |= __copy_from_user(current->thread.vr, v_regs,
33 * sizeof(vector128)); 33 * sizeof(vector128));
err |= __copy_from_user(current->thread.transact_vr, tm_v_regs, err |= __copy_from_user(current->thread.transact_vr, tm_v_regs,
...@@ -474,7 +474,7 @@ static long restore_tm_sigcontexts(struct pt_regs *regs, ...@@ -474,7 +474,7 @@ static long restore_tm_sigcontexts(struct pt_regs *regs,
memset(current->thread.transact_vr, 0, 33 * sizeof(vector128)); memset(current->thread.transact_vr, 0, 33 * sizeof(vector128));
} }
/* Always get VRSAVE back */ /* Always get VRSAVE back */
if (v_regs != 0 && tm_v_regs != 0) { if (v_regs != NULL && tm_v_regs != NULL) {
err |= __get_user(current->thread.vrsave, err |= __get_user(current->thread.vrsave,
(u32 __user *)&v_regs[33]); (u32 __user *)&v_regs[33]);
err |= __get_user(current->thread.transact_vrsave, err |= __get_user(current->thread.transact_vrsave,
......
...@@ -172,7 +172,7 @@ int smp_request_message_ipi(int virq, int msg) ...@@ -172,7 +172,7 @@ int smp_request_message_ipi(int virq, int msg)
#endif #endif
err = request_irq(virq, smp_ipi_action[msg], err = request_irq(virq, smp_ipi_action[msg],
IRQF_PERCPU | IRQF_NO_THREAD | IRQF_NO_SUSPEND, IRQF_PERCPU | IRQF_NO_THREAD | IRQF_NO_SUSPEND,
smp_ipi_name[msg], 0); smp_ipi_name[msg], NULL);
WARN(err < 0, "unable to request_irq %d for %s (rc %d)\n", WARN(err < 0, "unable to request_irq %d for %s (rc %d)\n",
virq, smp_ipi_name[msg], err); virq, smp_ipi_name[msg], err);
......
...@@ -907,7 +907,7 @@ static int subpage_protection(struct mm_struct *mm, unsigned long ea) ...@@ -907,7 +907,7 @@ static int subpage_protection(struct mm_struct *mm, unsigned long ea)
if (ea >= spt->maxaddr) if (ea >= spt->maxaddr)
return 0; return 0;
if (ea < 0x100000000) { if (ea < 0x100000000UL) {
/* addresses below 4GB use spt->low_prot */ /* addresses below 4GB use spt->low_prot */
sbpm = spt->low_prot; sbpm = spt->low_prot;
} else { } else {
......
...@@ -105,7 +105,7 @@ static void subpage_prot_clear(unsigned long addr, unsigned long len) ...@@ -105,7 +105,7 @@ static void subpage_prot_clear(unsigned long addr, unsigned long len)
limit = spt->maxaddr; limit = spt->maxaddr;
for (; addr < limit; addr = next) { for (; addr < limit; addr = next) {
next = pmd_addr_end(addr, limit); next = pmd_addr_end(addr, limit);
if (addr < 0x100000000) { if (addr < 0x100000000UL) {
spm = spt->low_prot; spm = spt->low_prot;
} else { } else {
spm = spt->protptrs[addr >> SBP_L3_SHIFT]; spm = spt->protptrs[addr >> SBP_L3_SHIFT];
...@@ -219,7 +219,7 @@ long sys_subpage_prot(unsigned long addr, unsigned long len, u32 __user *map) ...@@ -219,7 +219,7 @@ long sys_subpage_prot(unsigned long addr, unsigned long len, u32 __user *map)
for (limit = addr + len; addr < limit; addr = next) { for (limit = addr + len; addr < limit; addr = next) {
next = pmd_addr_end(addr, limit); next = pmd_addr_end(addr, limit);
err = -ENOMEM; err = -ENOMEM;
if (addr < 0x100000000) { if (addr < 0x100000000UL) {
spm = spt->low_prot; spm = spt->low_prot;
} else { } else {
spm = spt->protptrs[addr >> SBP_L3_SHIFT]; spm = spt->protptrs[addr >> SBP_L3_SHIFT];
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#define BHRB_MAX_ENTRIES 32 #define BHRB_MAX_ENTRIES 32
#define BHRB_TARGET 0x0000000000000002 #define BHRB_TARGET 0x0000000000000002
#define BHRB_PREDICTION 0x0000000000000001 #define BHRB_PREDICTION 0x0000000000000001
#define BHRB_EA 0xFFFFFFFFFFFFFFFC #define BHRB_EA 0xFFFFFFFFFFFFFFFCUL
struct cpu_hw_events { struct cpu_hw_events {
int n_events; int n_events;
......
...@@ -422,7 +422,7 @@ void opal_shutdown(void) ...@@ -422,7 +422,7 @@ void opal_shutdown(void)
for (i = 0; i < opal_irq_count; i++) { for (i = 0; i < opal_irq_count; i++) {
if (opal_irqs[i]) if (opal_irqs[i])
free_irq(opal_irqs[i], 0); free_irq(opal_irqs[i], NULL);
opal_irqs[i] = 0; opal_irqs[i] = 0;
} }
} }
...@@ -724,7 +724,7 @@ int h_get_mpp(struct hvcall_mpp_data *mpp_data) ...@@ -724,7 +724,7 @@ int h_get_mpp(struct hvcall_mpp_data *mpp_data)
mpp_data->mem_weight = (retbuf[3] >> 7 * 8) & 0xff; mpp_data->mem_weight = (retbuf[3] >> 7 * 8) & 0xff;
mpp_data->unallocated_mem_weight = (retbuf[3] >> 6 * 8) & 0xff; mpp_data->unallocated_mem_weight = (retbuf[3] >> 6 * 8) & 0xff;
mpp_data->unallocated_entitlement = retbuf[3] & 0xffffffffffff; mpp_data->unallocated_entitlement = retbuf[3] & 0xffffffffffffUL;
mpp_data->pool_size = retbuf[4]; mpp_data->pool_size = retbuf[4];
mpp_data->loan_request = retbuf[5]; mpp_data->loan_request = retbuf[5];
......
...@@ -108,8 +108,8 @@ static int drc_index_to_cpu(u32 drc_index) ...@@ -108,8 +108,8 @@ static int drc_index_to_cpu(u32 drc_index)
* energy consumption. * energy consumption.
*/ */
#define FLAGS_MODE1 0x004E200000080E01 #define FLAGS_MODE1 0x004E200000080E01UL
#define FLAGS_MODE2 0x004E200000080401 #define FLAGS_MODE2 0x004E200000080401UL
#define FLAGS_ACTIVATE 0x100 #define FLAGS_ACTIVATE 0x100
static ssize_t get_best_energy_list(char *page, int activate) static ssize_t get_best_energy_list(char *page, int activate)
......
...@@ -183,7 +183,7 @@ static void __init pseries_mpic_init_IRQ(void) ...@@ -183,7 +183,7 @@ static void __init pseries_mpic_init_IRQ(void)
np = of_find_node_by_path("/"); np = of_find_node_by_path("/");
naddr = of_n_addr_cells(np); naddr = of_n_addr_cells(np);
opprop = of_get_property(np, "platform-open-pic", &opplen); opprop = of_get_property(np, "platform-open-pic", &opplen);
if (opprop != 0) { if (opprop != NULL) {
openpic_addr = of_read_number(opprop, naddr); openpic_addr = of_read_number(opprop, naddr);
printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr); printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment