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