Commit 9893721c authored by Linus Torvalds's avatar Linus Torvalds

sparse: fix pointer/integer confusion

I don't think we're in K&R any more, Toto.

If you want a NULL pointer, use NULL. Don't use an integer.

Most of the users really didn't seem to know the proper type.
parent 4d1ae8c5
......@@ -43,7 +43,7 @@ void *dma_alloc_coherent(struct device *dev, size_t size,
if (dev->bus == &vio_bus_type)
return vio_alloc_consistent(to_vio_dev(dev), size, dma_handle);
BUG();
return 0;
return NULL;
}
EXPORT_SYMBOL(dma_alloc_coherent);
......
......@@ -29,7 +29,7 @@
#define CODE
#include "compat_ioctl.c"
#define HANDLE_IOCTL(cmd,handler) { cmd, (ioctl_trans_handler_t)handler, 0 },
#define HANDLE_IOCTL(cmd,handler) { cmd, (ioctl_trans_handler_t)handler, NULL },
#define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL(cmd,sys_ioctl)
#define IOCTL_TABLE_START \
......
......@@ -855,7 +855,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 */
entry = create_proc_entry("prof_cpu_mask", 0600, root_irq_dir);
......
......@@ -285,7 +285,7 @@ UnknownException(struct pt_regs *regs)
info.si_signo = SIGTRAP;
info.si_errno = 0;
info.si_code = 0;
info.si_addr = 0;
info.si_addr = NULL;
_exception(SIGTRAP, &info, regs);
}
......
......@@ -50,7 +50,7 @@ static int load_script(struct linux_binprm *bprm,struct pt_regs *regs)
if (*cp == '\0')
return -ENOEXEC; /* No interpreter name found */
i_name = cp;
i_arg = 0;
i_arg = NULL;
for ( ; *cp && (*cp != ' ') && (*cp != '\t'); cp++)
/* nothing */ ;
while ((*cp == ' ') || (*cp == '\t'))
......
......@@ -1420,7 +1420,7 @@ struct bh_lru {
struct buffer_head *bhs[BH_LRU_SIZE];
};
static DEFINE_PER_CPU(struct bh_lru, bh_lrus) = {{0}};
static DEFINE_PER_CPU(struct bh_lru, bh_lrus) = {{ NULL }};
#ifdef CONFIG_SMP
#define bh_lru_lock() local_irq_disable()
......@@ -2487,7 +2487,7 @@ int nobh_prepare_write(struct page *page, unsigned from, unsigned to,
}
bh->b_state = map_bh.b_state;
atomic_set(&bh->b_count, 0);
bh->b_this_page = 0;
bh->b_this_page = NULL;
bh->b_page = page;
bh->b_blocknr = map_bh.b_blocknr;
bh->b_size = blocksize;
......
......@@ -269,7 +269,7 @@ static void ioctl32_insert_translation(struct ioctl_trans *trans)
t = ioctl32_hash_table[hash];
while (t->next)
t = t->next;
trans->next = 0;
trans->next = NULL;
t->next = trans;
}
}
......
......@@ -788,7 +788,7 @@ static int routing_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
ret |= copy_from_user (devname, compat_ptr(rtdev), 15);
r4.rt_dev = devname; devname[15] = 0;
} else
r4.rt_dev = 0;
r4.rt_dev = NULL;
r = (void *) &r4;
}
......
......@@ -159,7 +159,7 @@ void free_fdset(fd_set *array, int num)
*/
int expand_fdset(struct files_struct *files, int nr)
{
fd_set *new_openset = 0, *new_execset = 0;
fd_set *new_openset = NULL, *new_execset = NULL;
int error, nfds = 0;
error = -EMFILE;
......
......@@ -177,7 +177,7 @@ void locks_init_lock(struct file_lock *fl)
init_waitqueue_head(&fl->fl_wait);
fl->fl_next = NULL;
fl->fl_fasync = NULL;
fl->fl_owner = 0;
fl->fl_owner = NULL;
fl->fl_pid = 0;
fl->fl_file = NULL;
fl->fl_flags = 0;
......
......@@ -400,7 +400,7 @@ static int do_umount(struct vfsmount *mnt, int flags)
down_write(&sb->s_umount);
if (!(sb->s_flags & MS_RDONLY)) {
lock_kernel();
retval = do_remount_sb(sb, MS_RDONLY, 0, 0);
retval = do_remount_sb(sb, MS_RDONLY, NULL, 0);
unlock_kernel();
}
up_write(&sb->s_umount);
......
......@@ -75,7 +75,7 @@ static inline unsigned long hugetlb_total_pages(void)
#define hugetlb_report_meminfo(buf) 0
#define hugetlb_report_node_meminfo(n, buf) 0
#define mark_mm_hugetlb(mm, vma) do { } while (0)
#define follow_huge_pmd(mm, addr, pmd, write) 0
#define follow_huge_pmd(mm, addr, pmd, write) NULL
#define is_aligned_hugepage_range(addr, len) 0
#define prepare_hugepage_range(addr, len) (-EINVAL)
#define pmd_huge(x) 0
......
......@@ -58,7 +58,7 @@ static void __init handle_initrd(void)
pid = kernel_thread(do_linuxrc, "/linuxrc", SIGCHLD);
if (pid > 0) {
while (pid != sys_wait4(-1, &i, 0, 0))
while (pid != sys_wait4(-1, &i, 0, NULL))
yield();
}
......
......@@ -58,14 +58,7 @@ struct dma_chan {
};
static struct dma_chan dma_chan_busy[MAX_DMA_CHANNELS] = {
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 1, "cascade" },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 }
[4] = { 1, "cascade" },
};
......
......@@ -134,7 +134,7 @@ asmlinkage long sys_setitimer(int which,
} else
memset((char *) &set_buffer, 0, sizeof(set_buffer));
error = do_setitimer(which, &set_buffer, ovalue ? &get_buffer : 0);
error = do_setitimer(which, &set_buffer, ovalue ? &get_buffer : NULL);
if (error || !ovalue)
return error;
......
......@@ -210,7 +210,7 @@ static __init int init_posix_timers(void)
register_posix_clock(CLOCK_MONOTONIC, &clock_monotonic);
posix_timers_cache = kmem_cache_create("posix_timers_cache",
sizeof (struct k_itimer), 0, 0, 0, 0);
sizeof (struct k_itimer), 0, 0, NULL, NULL);
idr_init(&posix_timers_id);
return 0;
......@@ -399,7 +399,7 @@ static struct k_itimer * alloc_posix_timer(void)
memset(tmr, 0, sizeof (struct k_itimer));
if (unlikely(!(tmr->sigq = sigqueue_alloc()))) {
kmem_cache_free(posix_timers_cache, tmr);
tmr = 0;
tmr = NULL;
}
return tmr;
}
......@@ -431,7 +431,7 @@ sys_timer_create(clockid_t which_clock,
int error = 0;
struct k_itimer *new_timer = NULL;
int new_timer_id;
struct task_struct *process = 0;
struct task_struct *process = NULL;
unsigned long flags;
sigevent_t event;
int it_id_set = IT_ID_NOT_SET;
......@@ -521,7 +521,7 @@ sys_timer_create(clockid_t which_clock,
get_task_struct(process);
} else {
spin_unlock_irqrestore(&process->sighand->siglock, flags);
process = 0;
process = NULL;
}
}
read_unlock(&tasklist_lock);
......
......@@ -264,7 +264,7 @@ next_signal(struct sigpending *pending, sigset_t *mask)
static struct sigqueue *__sigqueue_alloc(void)
{
struct sigqueue *q = 0;
struct sigqueue *q = NULL;
if (atomic_read(&current->user->sigpending) <
current->rlim[RLIMIT_SIGPENDING].rlim_cur)
......@@ -272,7 +272,7 @@ static struct sigqueue *__sigqueue_alloc(void)
if (q) {
INIT_LIST_HEAD(&q->list);
q->flags = 0;
q->lock = 0;
q->lock = NULL;
q->user = get_uid(current->user);
atomic_inc(&q->user->sigpending);
}
......@@ -454,7 +454,7 @@ unblock_all_signals(void)
static inline int collect_signal(int sig, struct sigpending *list, siginfo_t *info)
{
struct sigqueue *q, *first = 0;
struct sigqueue *q, *first = NULL;
int still_pending = 0;
if (unlikely(!sigismember(&list->signal, sig)))
......
......@@ -669,7 +669,7 @@ follow_page(struct mm_struct *mm, unsigned long address, int write)
static inline struct page *get_page_map(struct page *page)
{
if (!pfn_valid(page_to_pfn(page)))
return 0;
return NULL;
return page;
}
......@@ -1805,7 +1805,7 @@ struct vm_area_struct *get_gate_vma(struct task_struct *tsk)
#ifdef AT_SYSINFO_EHDR
return &gate_vma;
#else
return 0;
return NULL;
#endif
}
......
......@@ -474,7 +474,7 @@ struct cache_names {
static struct cache_names __initdata cache_names[] = {
#define CACHE(x) { .name = "size-" #x, .name_dma = "size-" #x "(DMA)" },
#include <linux/kmalloc_sizes.h>
{ 0, }
{ NULL, }
#undef CACHE
};
......
......@@ -1293,7 +1293,7 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags)
int i, prev;
int error;
static int least_priority;
union swap_header *swap_header = 0;
union swap_header *swap_header = NULL;
int swap_header_version;
int nr_good_pages = 0;
unsigned long maxpages = 1;
......
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