Commit c8cc6377 authored by David Mosberger's avatar David Mosberger Committed by Tony Luck

[IA64] sparse 0 vs. NULL cleanup patch

Sparse really wants NULL for NULL-pointers.  This patch makes it so.
The patch should be safe.  It compiles fine, creates no additional
warnings, and the results has been boot-tested on an rx2600.
Signed-off-by: default avatarDavid Mosberger-Tang <davidm@hpl.hp.com>
Signed-off-by: default avatarTony Luck <tomy.luck@intel.com>
parent 461535b0
......@@ -1153,7 +1153,7 @@ sba_fill_pdir(
{
struct scatterlist *dma_sg = startsg; /* pointer to current DMA */
int n_mappings = 0;
u64 *pdirp = 0;
u64 *pdirp = NULL;
unsigned long dma_offset = 0;
dma_sg--;
......@@ -1875,7 +1875,7 @@ ioc_proc_init(void)
{
struct proc_dir_entry *dir, *entry;
dir = proc_mkdir("bus/mckinley", 0);
dir = proc_mkdir("bus/mckinley", NULL);
if (!dir)
return;
......
......@@ -223,7 +223,7 @@ ia32_bad_interrupt (unsigned long int_num, struct pt_regs *regs)
siginfo.si_errno = int_num; /* XXX is it OK to abuse si_errno like this? */
siginfo.si_flags = 0;
siginfo.si_isr = 0;
siginfo.si_addr = 0;
siginfo.si_addr = NULL;
siginfo.si_imm = 0;
siginfo.si_code = TRAP_BRKPT;
force_sig_info(SIGTRAP, &siginfo, current);
......
......@@ -361,7 +361,7 @@ void ia64_elf32_init(struct pt_regs *regs);
/* This macro yields a string that ld.so will use to load
implementation specific libraries for optimization. Not terribly
relevant until we have real hardware to play with... */
#define ELF_PLATFORM 0
#define ELF_PLATFORM NULL
#ifdef __KERNEL__
# define SET_PERSONALITY(EX,IBCS2) \
......
......@@ -215,7 +215,7 @@ mmap_subpage (struct file *file, unsigned long start, unsigned long end, int pro
down_write(&current->mm->mmap_sem);
{
ret = do_mmap(0, PAGE_START(start), PAGE_SIZE, prot | PROT_WRITE,
ret = do_mmap(NULL, PAGE_START(start), PAGE_SIZE, prot | PROT_WRITE,
flags | MAP_FIXED | MAP_ANONYMOUS, 0);
}
up_write(&current->mm->mmap_sem);
......@@ -266,9 +266,9 @@ ia32_init_pp_list(void)
if ((p = kmalloc(sizeof(*p), GFP_KERNEL)) == NULL)
return p;
p->pp_head = 0;
p->pp_head = NULL;
p->ppl_rb = RB_ROOT;
p->pp_hint = 0;
p->pp_hint = NULL;
atomic_set(&p->pp_count, 1);
return p;
}
......@@ -825,7 +825,7 @@ emulate_mmap (struct file *file, unsigned long start, unsigned long len, int pro
if (!(flags & MAP_ANONYMOUS) && is_congruent)
ret = do_mmap(file, pstart, pend - pstart, prot, flags | MAP_FIXED, poff);
else
ret = do_mmap(0, pstart, pend - pstart,
ret = do_mmap(NULL, pstart, pend - pstart,
prot | ((flags & MAP_ANONYMOUS) ? 0 : PROT_WRITE),
flags | MAP_FIXED | MAP_ANONYMOUS, 0);
}
......
......@@ -62,7 +62,7 @@ acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor *id,
struct acpi_vendor_info info;
info.descriptor = id;
info.data = 0;
info.data = NULL;
acpi_walk_resources(obj, METHOD_NAME__CRS, acpi_vendor_resource_match, &info);
if (!info.data)
......
......@@ -48,7 +48,7 @@ static efi_status_t \
prefix##_get_time (efi_time_t *tm, efi_time_cap_t *tc) \
{ \
struct ia64_fpreg fr[6]; \
efi_time_cap_t *atc = 0; \
efi_time_cap_t *atc = NULL; \
efi_status_t ret; \
\
if (tc) \
......@@ -91,7 +91,7 @@ static efi_status_t \
prefix##_set_wakeup_time (efi_bool_t enabled, efi_time_t *tm) \
{ \
struct ia64_fpreg fr[6]; \
efi_time_t *atm = 0; \
efi_time_t *atm = NULL; \
efi_status_t ret; \
\
if (tm) \
......@@ -109,7 +109,7 @@ prefix##_get_variable (efi_char16_t *name, efi_guid_t *vendor, u32 *attr, \
unsigned long *data_size, void *data) \
{ \
struct ia64_fpreg fr[6]; \
u32 *aattr = 0; \
u32 *aattr = NULL; \
efi_status_t ret; \
\
if (attr) \
......@@ -172,7 +172,7 @@ prefix##_reset_system (int reset_type, efi_status_t status, \
unsigned long data_size, efi_char16_t *data) \
{ \
struct ia64_fpreg fr[6]; \
efi_char16_t *adata = 0; \
efi_char16_t *adata = NULL; \
\
if (data) \
adata = adjust_arg(data); \
......@@ -214,7 +214,7 @@ efi_gettimeofday (struct timespec *ts)
efi_time_t tm;
memset(ts, 0, sizeof(ts));
if ((*efi.get_time)(&tm, 0) != EFI_SUCCESS)
if ((*efi.get_time)(&tm, NULL) != EFI_SUCCESS)
return;
ts->tv_sec = mktime(tm.year, tm.month, tm.day, tm.hour, tm.minute, tm.second);
......
......@@ -1180,7 +1180,7 @@ void init_irq_proc (void)
int i;
/* create /proc/irq */
root_irq_dir = proc_mkdir("irq", 0);
root_irq_dir = proc_mkdir("irq", NULL);
/* create /proc/irq/prof_cpu_mask */
create_prof_cpu_mask(root_irq_dir);
......
......@@ -74,12 +74,12 @@ void
show_stack (struct task_struct *task, unsigned long *sp)
{
if (!task)
unw_init_running(ia64_do_show_stack, 0);
unw_init_running(ia64_do_show_stack, NULL);
else {
struct unw_frame_info info;
unw_init_from_blocked_task(&info, task);
ia64_do_show_stack(&info, 0);
ia64_do_show_stack(&info, NULL);
}
}
......@@ -751,7 +751,7 @@ cpu_halt (void)
void
machine_restart (char *restart_cmd)
{
(*efi.reset_system)(EFI_RESET_WARM, 0, 0, 0);
(*efi.reset_system)(EFI_RESET_WARM, 0, 0, NULL);
}
EXPORT_SYMBOL(machine_restart);
......
......@@ -680,7 +680,7 @@ cpu_init (void)
break;
}
if (ia64_pal_rse_info(&num_phys_stacked, 0) != 0) {
if (ia64_pal_rse_info(&num_phys_stacked, NULL) != 0) {
printk(KERN_WARNING "cpu_init: PAL RSE info failed; assuming 96 physical "
"stacked regs\n");
num_phys_stacked = 96;
......
......@@ -260,7 +260,7 @@ ia64_rt_sigreturn (struct sigscratch *scr)
* It is more difficult to avoid calling this function than to
* call it and ignore errors.
*/
do_sigaltstack(&sc->sc_stack, 0, scr->pt.r12);
do_sigaltstack(&sc->sc_stack, NULL, scr->pt.r12);
return retval;
give_sigsegv:
......
......@@ -225,7 +225,7 @@ smp_send_reschedule (int cpu)
void
smp_flush_tlb_all (void)
{
on_each_cpu((void (*)(void *))local_flush_tlb_all, 0, 1, 1);
on_each_cpu((void (*)(void *))local_flush_tlb_all, NULL, 1, 1);
}
EXPORT_SYMBOL(smp_flush_tlb_all);
......
......@@ -183,7 +183,7 @@ static inline unsigned long
do_mmap2 (unsigned long addr, unsigned long len, int prot, int flags, int fd, unsigned long pgoff)
{
unsigned long roff;
struct file *file = 0;
struct file *file = NULL;
flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
if (!(flags & MAP_ANONYMOUS)) {
......
......@@ -167,7 +167,7 @@ ia64_init_itm (void)
if (status != 0) {
printk(KERN_ERR "SAL_FREQ_BASE_PLATFORM failed: %s\n", ia64_sal_strerror(status));
} else {
status = ia64_pal_freq_ratios(&proc_ratio, 0, &itc_ratio);
status = ia64_pal_freq_ratios(&proc_ratio, NULL, &itc_ratio);
if (status != 0)
printk(KERN_ERR "PAL_FREQ_RATIOS failed with status=%ld\n", status);
}
......
......@@ -869,7 +869,7 @@ emulate_store_int (unsigned long ifa, load_store_t ld, struct pt_regs *regs)
*
* extract the value to be stored
*/
getreg(ld.imm, &r2, 0, regs);
getreg(ld.imm, &r2, NULL, regs);
/*
* we rely on the macros in unaligned.h for now i.e.,
......
......@@ -446,7 +446,7 @@ EXPORT_SYMBOL(unw_access_br);
int
unw_access_fr (struct unw_frame_info *info, int regnum, struct ia64_fpreg *val, int write)
{
struct ia64_fpreg *addr = 0;
struct ia64_fpreg *addr = NULL;
struct pt_regs *pt;
if ((unsigned) (regnum - 2) >= 126) {
......@@ -842,7 +842,7 @@ desc_prologue (int body, unw_word rlen, unsigned char mask, unsigned char grsave
}
sr->gr_save_loc = grsave;
sr->any_spills = 0;
sr->imask = 0;
sr->imask = NULL;
sr->spill_offset = 0x10; /* default to psp+16 */
}
}
......@@ -1230,7 +1230,7 @@ script_lookup (struct unw_frame_info *info)
unsigned long ip, pr;
if (UNW_DEBUG_ON(0))
return 0; /* Always regenerate scripts in debug mode */
return NULL; /* Always regenerate scripts in debug mode */
STAT(++unw.stat.cache.lookups);
......@@ -1244,7 +1244,7 @@ script_lookup (struct unw_frame_info *info)
index = unw.hash[hash(ip)];
if (index >= UNW_CACHE_SIZE)
return 0;
return NULL;
script = unw.cache + index;
while (1) {
......@@ -1255,7 +1255,7 @@ script_lookup (struct unw_frame_info *info)
return script;
}
if (script->coll_chain >= UNW_HASH_SIZE)
return 0;
return NULL;
script = unw.cache + script->coll_chain;
STAT(++unw.stat.cache.collision_chain_traversals);
}
......@@ -1305,7 +1305,7 @@ script_new (unsigned long ip)
if (script->ip) {
index = hash(script->ip);
tmp = unw.cache + unw.hash[index];
prev = 0;
prev = NULL;
while (1) {
if (tmp == script) {
if (prev)
......@@ -1510,7 +1510,7 @@ compile_reg (struct unw_state_record *sr, int i, struct unw_script *script)
static inline const struct unw_table_entry *
lookup (struct unw_table *table, unsigned long rel_ip)
{
const struct unw_table_entry *e = 0;
const struct unw_table_entry *e = NULL;
unsigned long lo, hi, mid;
/* do a binary search for right entry: */
......@@ -1536,8 +1536,8 @@ lookup (struct unw_table *table, unsigned long rel_ip)
static inline struct unw_script *
build_script (struct unw_frame_info *info)
{
const struct unw_table_entry *e = 0;
struct unw_script *script = 0;
const struct unw_table_entry *e = NULL;
struct unw_script *script = NULL;
struct unw_labeled_state *ls, *next;
unsigned long ip = info->ip;
struct unw_state_record sr;
......@@ -1562,7 +1562,7 @@ build_script (struct unw_frame_info *info)
if (!script) {
UNW_DPRINT(0, "unwind.%s: failed to create unwind script\n", __FUNCTION__);
STAT(unw.stat.script.build_time += ia64_get_itc() - start);
return 0;
return NULL;
}
unw.cache[info->prev_script].hint = script - unw.cache;
......@@ -1835,7 +1835,7 @@ find_save_locs (struct unw_frame_info *info)
/* don't let obviously bad addresses pollute the cache */
/* FIXME: should really be level 0 but it occurs too often. KAO */
UNW_DPRINT(1, "unwind.%s: rejecting bad ip=0x%lx\n", __FUNCTION__, info->ip);
info->rp_loc = 0;
info->rp_loc = NULL;
return -1;
}
......@@ -2092,12 +2092,12 @@ unw_add_unwind_table (const char *name, unsigned long segment_base, unsigned lon
if (end - start <= 0) {
UNW_DPRINT(0, "unwind.%s: ignoring attempt to insert empty unwind table\n",
__FUNCTION__);
return 0;
return NULL;
}
table = kmalloc(sizeof(*table), GFP_USER);
if (!table)
return 0;
return NULL;
init_unwind_table(table, name, segment_base, gp, table_start, table_end);
......
......@@ -277,7 +277,7 @@ paging_init (void)
map_size = PAGE_ALIGN(max_low_pfn * sizeof(struct page));
vmalloc_end -= map_size;
vmem_map = (struct page *) vmalloc_end;
efi_memmap_walk(create_mem_map_page_table, 0);
efi_memmap_walk(create_mem_map_page_table, NULL);
mem_map = contig_page_data.node_mem_map = vmem_map;
free_area_init_node(0, &contig_page_data, zones_size,
......
......@@ -77,7 +77,7 @@ search_extable (const struct exception_table_entry *first,
else
last = mid - 1;
}
return 0;
return NULL;
}
void
......
......@@ -67,9 +67,9 @@ check_pgt_cache (void)
if (pgtable_cache_size > (u64) high) {
do {
if (pgd_quicklist)
free_page((unsigned long)pgd_alloc_one_fast(0));
free_page((unsigned long)pgd_alloc_one_fast(NULL));
if (pmd_quicklist)
free_page((unsigned long)pmd_alloc_one_fast(0, 0));
free_page((unsigned long)pmd_alloc_one_fast(NULL, 0));
} while (pgtable_cache_size > (u64) low);
}
preempt_enable();
......
......@@ -97,7 +97,7 @@ static int __init hp_zx1_ioc_shared(void)
default:
printk(KERN_ERR PFX "Invalid IOTLB page size "
"configuration 0x%x\n", hp->io_tlb_ps);
hp->gatt = 0;
hp->gatt = NULL;
hp->gatt_entries = 0;
return -ENODEV;
}
......@@ -115,7 +115,7 @@ static int __init hp_zx1_ioc_shared(void)
if (hp->gatt[0] != HP_ZX1_SBA_IOMMU_COOKIE) {
/* Normal case when no AGP device in system */
hp->gatt = 0;
hp->gatt = NULL;
hp->gatt_entries = 0;
printk(KERN_ERR PFX "No reserved IO PDIR entry found; "
"GART disabled\n");
......@@ -294,7 +294,7 @@ hp_zx1_create_gatt_table (void)
if (!hp->io_pdir) {
printk(KERN_ERR PFX "Couldn't allocate contiguous "
"memory for I/O PDIR\n");
hp->gatt = 0;
hp->gatt = NULL;
hp->gatt_entries = 0;
return -ENOMEM;
}
......
......@@ -4,7 +4,7 @@
/*
* ELF-specific definitions.
*
* Copyright (C) 1998-1999, 2002-2003 Hewlett-Packard Co
* Copyright (C) 1998-1999, 2002-2004 Hewlett-Packard Co
* David Mosberger-Tang <davidm@hpl.hp.com>
*/
......@@ -175,7 +175,7 @@ extern void ia64_elf_core_copy_regs (struct pt_regs *src, elf_gregset_t dst);
/* This macro yields a string that ld.so will use to load
implementation specific libraries for optimization. Not terribly
relevant until we have real hardware to play with... */
#define ELF_PLATFORM 0
#define ELF_PLATFORM NULL
/*
* Architecture-neutral AT_ values are in the range 0-17. Leave some room for more of
......
......@@ -262,7 +262,7 @@ struct thread_struct {
.fdr = 0, \
.old_k1 = 0, \
.old_iob = 0, \
.ppl = 0,
.ppl = NULL,
#else
# define INIT_THREAD_IA32
#endif /* CONFIG_IA32_SUPPORT */
......
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