diff options
author | Stephen Hemminger <shemminger@linux-foundation.org> | 2007-10-18 03:07:05 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-18 14:37:31 -0700 |
commit | c80544dc0b87bb65038355e7aafdc30be16b26ab (patch) | |
tree | 176349304bec88a9de16e650c9919462e0dd453c | |
parent | 0e9663ee452ffce0d429656ebbcfe69417a30e92 (diff) | |
download | kernel_goldelico_gta04-c80544dc0b87bb65038355e7aafdc30be16b26ab.zip kernel_goldelico_gta04-c80544dc0b87bb65038355e7aafdc30be16b26ab.tar.gz kernel_goldelico_gta04-c80544dc0b87bb65038355e7aafdc30be16b26ab.tar.bz2 |
sparse pointer use of zero as null
Get rid of sparse related warnings from places that use integer as NULL
pointer.
[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Cc: Andi Kleen <ak@suse.de>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Matt Mackall <mpm@selenic.com>
Cc: Ian Kent <raven@themaw.net>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Davide Libenzi <davidel@xmailserver.org>
Cc: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | arch/x86/kernel/vsyscall_64.c | 2 | ||||
-rw-r--r-- | drivers/ata/libata-sff.c | 2 | ||||
-rw-r--r-- | drivers/base/dmapool.c | 2 | ||||
-rw-r--r-- | drivers/char/random.c | 2 | ||||
-rw-r--r-- | fs/autofs/waitq.c | 2 | ||||
-rw-r--r-- | fs/autofs4/waitq.c | 2 | ||||
-rw-r--r-- | fs/compat_ioctl.c | 2 | ||||
-rw-r--r-- | fs/eventpoll.c | 2 | ||||
-rw-r--r-- | fs/ext3/fsync.c | 2 | ||||
-rw-r--r-- | fs/ext3/inode.c | 2 | ||||
-rw-r--r-- | fs/jbd/journal.c | 9 | ||||
-rw-r--r-- | fs/jbd/transaction.c | 12 | ||||
-rw-r--r-- | fs/nls/nls_base.c | 2 | ||||
-rw-r--r-- | init/do_mounts_rd.c | 6 | ||||
-rw-r--r-- | kernel/futex.c | 4 | ||||
-rw-r--r-- | kernel/kexec.c | 4 | ||||
-rw-r--r-- | mm/hugetlb.c | 2 | ||||
-rw-r--r-- | mm/mremap.c | 4 | ||||
-rw-r--r-- | mm/vmscan.c | 2 | ||||
-rw-r--r-- | security/selinux/xfrm.c | 2 |
20 files changed, 34 insertions, 33 deletions
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c index cf7a47b..585541c 100644 --- a/arch/x86/kernel/vsyscall_64.c +++ b/arch/x86/kernel/vsyscall_64.c @@ -172,7 +172,7 @@ time_t __vsyscall(1) vtime(time_t *t) if (unlikely(!__vsyscall_gtod_data.sysctl_enabled)) return time_syscall(t); - vgettimeofday(&tv, 0); + vgettimeofday(&tv, NULL); result = tv.tv_sec; if (t) *t = result; diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 026439e..c750105 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c @@ -882,7 +882,7 @@ unsigned long ata_pci_default_filter(struct ata_device *adev, unsigned long xfer /* Filter out DMA modes if the device has been configured by the BIOS as PIO only */ - if (adev->link->ap->ioaddr.bmdma_addr == 0) + if (adev->link->ap->ioaddr.bmdma_addr == NULL) xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); return xfer_mask; } diff --git a/drivers/base/dmapool.c b/drivers/base/dmapool.c index fbae867..5beddc3 100644 --- a/drivers/base/dmapool.c +++ b/drivers/base/dmapool.c @@ -366,7 +366,7 @@ dma_pool_free (struct dma_pool *pool, void *vaddr, dma_addr_t dma) unsigned long flags; int map, block; - if ((page = pool_find_page (pool, dma)) == 0) { + if ((page = pool_find_page(pool, dma)) == NULL) { if (pool->dev) dev_err(pool->dev, "dma_pool_free %s, %p/%lx (bad dma)\n", pool->name, vaddr, (unsigned long) dma); diff --git a/drivers/char/random.c b/drivers/char/random.c index af274e5..1756b1f 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -649,7 +649,7 @@ EXPORT_SYMBOL_GPL(add_input_randomness); void add_interrupt_randomness(int irq) { - if (irq >= NR_IRQS || irq_timer_state[irq] == 0) + if (irq >= NR_IRQS || irq_timer_state[irq] == NULL) return; DEBUG_ENT("irq event %d\n", irq); diff --git a/fs/autofs/waitq.c b/fs/autofs/waitq.c index 19a9caf..be46805 100644 --- a/fs/autofs/waitq.c +++ b/fs/autofs/waitq.c @@ -182,7 +182,7 @@ int autofs_wait_release(struct autofs_sb_info *sbi, autofs_wqt_t wait_queue_toke { struct autofs_wait_queue *wq, **wql; - for ( wql = &sbi->queues ; (wq = *wql) != 0 ; wql = &wq->next ) { + for (wql = &sbi->queues; (wq = *wql) != NULL; wql = &wq->next) { if ( wq->wait_queue_token == wait_queue_token ) break; } diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c index 0d041a9..1fe28e4 100644 --- a/fs/autofs4/waitq.c +++ b/fs/autofs4/waitq.c @@ -376,7 +376,7 @@ int autofs4_wait_release(struct autofs_sb_info *sbi, autofs_wqt_t wait_queue_tok struct autofs_wait_queue *wq, **wql; mutex_lock(&sbi->wq_mutex); - for (wql = &sbi->queues ; (wq = *wql) != 0 ; wql = &wq->next) { + for (wql = &sbi->queues; (wq = *wql) != NULL; wql = &wq->next) { if (wq->wait_queue_token == wait_queue_token) break; } diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 6dacd39..a4284cc 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -3001,7 +3001,7 @@ static int __init init_sys32_ioctl(void) int i; for (i = 0; i < ARRAY_SIZE(ioctl_start); i++) { - if (ioctl_start[i].next != 0) { + if (ioctl_start[i].next) { printk("ioctl translation %d bad\n",i); return -1; } diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 77b9953..de61892 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -463,7 +463,7 @@ static void ep_free(struct eventpoll *ep) * holding "epmutex" we can be sure that no file cleanup code will hit * us during this operation. So we can avoid the lock on "ep->lock". */ - while ((rbp = rb_first(&ep->rbr)) != 0) { + while ((rbp = rb_first(&ep->rbr)) != NULL) { epi = rb_entry(rbp, struct epitem, rbn); ep_remove(ep, epi); } diff --git a/fs/ext3/fsync.c b/fs/ext3/fsync.c index dd1fd3c..a588e23 100644 --- a/fs/ext3/fsync.c +++ b/fs/ext3/fsync.c @@ -47,7 +47,7 @@ int ext3_sync_file(struct file * file, struct dentry *dentry, int datasync) struct inode *inode = dentry->d_inode; int ret = 0; - J_ASSERT(ext3_journal_current_handle() == 0); + J_ASSERT(ext3_journal_current_handle() == NULL); /* * data=writeback: diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index 2f2b686..3dec003 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c @@ -1028,7 +1028,7 @@ struct buffer_head *ext3_getblk(handle_t *handle, struct inode *inode, } if (buffer_new(&dummy)) { J_ASSERT(create != 0); - J_ASSERT(handle != 0); + J_ASSERT(handle != NULL); /* * Now that we do not always journal data, we should diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c index 65c2904..5d9fec0 100644 --- a/fs/jbd/journal.c +++ b/fs/jbd/journal.c @@ -217,7 +217,7 @@ static int journal_start_thread(journal_t *journal) if (IS_ERR(t)) return PTR_ERR(t); - wait_event(journal->j_wait_done_commit, journal->j_task != 0); + wait_event(journal->j_wait_done_commit, journal->j_task != NULL); return 0; } @@ -229,7 +229,8 @@ static void journal_kill_thread(journal_t *journal) while (journal->j_task) { wake_up(&journal->j_wait_commit); spin_unlock(&journal->j_state_lock); - wait_event(journal->j_wait_done_commit, journal->j_task == 0); + wait_event(journal->j_wait_done_commit, + journal->j_task == NULL); spin_lock(&journal->j_state_lock); } spin_unlock(&journal->j_state_lock); @@ -1651,14 +1652,14 @@ static struct journal_head *journal_alloc_journal_head(void) atomic_inc(&nr_journal_heads); #endif ret = kmem_cache_alloc(journal_head_cache, GFP_NOFS); - if (ret == 0) { + if (ret == NULL) { jbd_debug(1, "out of memory for journal_head\n"); if (time_after(jiffies, last_warning + 5*HZ)) { printk(KERN_NOTICE "ENOMEM in %s, retrying.\n", __FUNCTION__); last_warning = jiffies; } - while (ret == 0) { + while (ret == NULL) { yield(); ret = kmem_cache_alloc(journal_head_cache, GFP_NOFS); } diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c index 0282deb..9841b1e 100644 --- a/fs/jbd/transaction.c +++ b/fs/jbd/transaction.c @@ -1172,7 +1172,7 @@ int journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) } /* That test should have eliminated the following case: */ - J_ASSERT_JH(jh, jh->b_frozen_data == 0); + J_ASSERT_JH(jh, jh->b_frozen_data == NULL); JBUFFER_TRACE(jh, "file as BJ_Metadata"); spin_lock(&journal->j_list_lock); @@ -1522,7 +1522,7 @@ static void __journal_temp_unlink_buffer(struct journal_head *jh) J_ASSERT_JH(jh, jh->b_jlist < BJ_Types); if (jh->b_jlist != BJ_None) - J_ASSERT_JH(jh, transaction != 0); + J_ASSERT_JH(jh, transaction != NULL); switch (jh->b_jlist) { case BJ_None: @@ -1591,11 +1591,11 @@ __journal_try_to_free_buffer(journal_t *journal, struct buffer_head *bh) if (buffer_locked(bh) || buffer_dirty(bh)) goto out; - if (jh->b_next_transaction != 0) + if (jh->b_next_transaction != NULL) goto out; spin_lock(&journal->j_list_lock); - if (jh->b_transaction != 0 && jh->b_cp_transaction == 0) { + if (jh->b_transaction != NULL && jh->b_cp_transaction == NULL) { if (jh->b_jlist == BJ_SyncData || jh->b_jlist == BJ_Locked) { /* A written-back ordered data buffer */ JBUFFER_TRACE(jh, "release data"); @@ -1603,7 +1603,7 @@ __journal_try_to_free_buffer(journal_t *journal, struct buffer_head *bh) journal_remove_journal_head(bh); __brelse(bh); } - } else if (jh->b_cp_transaction != 0 && jh->b_transaction == 0) { + } else if (jh->b_cp_transaction != NULL && jh->b_transaction == NULL) { /* written-back checkpointed metadata buffer */ if (jh->b_jlist == BJ_None) { JBUFFER_TRACE(jh, "remove from checkpoint list"); @@ -1963,7 +1963,7 @@ void __journal_file_buffer(struct journal_head *jh, J_ASSERT_JH(jh, jh->b_jlist < BJ_Types); J_ASSERT_JH(jh, jh->b_transaction == transaction || - jh->b_transaction == 0); + jh->b_transaction == NULL); if (jh->b_transaction && jh->b_jlist == jlist) return; diff --git a/fs/nls/nls_base.c b/fs/nls/nls_base.c index e790581..64965e1 100644 --- a/fs/nls/nls_base.c +++ b/fs/nls/nls_base.c @@ -111,7 +111,7 @@ utf8_wctomb(__u8 *s, wchar_t wc, int maxlen) int c, nc; const struct utf8_table *t; - if (s == 0) + if (!s) return 0; l = wc; diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c index ed652f4..3ac5904 100644 --- a/init/do_mounts_rd.c +++ b/init/do_mounts_rd.c @@ -57,7 +57,7 @@ identify_ramdisk_image(int fd, int start_block) unsigned char *buf; buf = kmalloc(size, GFP_KERNEL); - if (buf == 0) + if (!buf) return -1; minixsb = (struct minix_super_block *) buf; @@ -407,12 +407,12 @@ static int __init crd_load(int in_fd, int out_fd) crd_infd = in_fd; crd_outfd = out_fd; inbuf = kmalloc(INBUFSIZ, GFP_KERNEL); - if (inbuf == 0) { + if (!inbuf) { printk(KERN_ERR "RAMDISK: Couldn't allocate gzip buffer\n"); return -1; } window = kmalloc(WSIZE, GFP_KERNEL); - if (window == 0) { + if (!window) { printk(KERN_ERR "RAMDISK: Couldn't allocate gzip window\n"); kfree(inbuf); return -1; diff --git a/kernel/futex.c b/kernel/futex.c index d725676..e45a65e 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -293,7 +293,7 @@ EXPORT_SYMBOL_GPL(get_futex_key_refs); */ void drop_futex_key_refs(union futex_key *key) { - if (key->both.ptr == 0) + if (!key->both.ptr) return; switch (key->both.offset & (FUT_OFF_INODE|FUT_OFF_MMSHARED)) { case FUT_OFF_INODE: @@ -1046,7 +1046,7 @@ static int unqueue_me(struct futex_q *q) retry: lock_ptr = q->lock_ptr; barrier(); - if (lock_ptr != 0) { + if (lock_ptr != NULL) { spin_lock(lock_ptr); /* * q->lock_ptr can change between reading it and diff --git a/kernel/kexec.c b/kernel/kexec.c index 7885269..e9f1b4e 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c @@ -785,7 +785,7 @@ static int kimage_load_normal_segment(struct kimage *image, size_t uchunk, mchunk; page = kimage_alloc_page(image, GFP_HIGHUSER, maddr); - if (page == 0) { + if (!page) { result = -ENOMEM; goto out; } @@ -844,7 +844,7 @@ static int kimage_load_crash_segment(struct kimage *image, size_t uchunk, mchunk; page = pfn_to_page(maddr >> PAGE_SHIFT); - if (page == 0) { + if (!page) { result = -ENOMEM; goto out; } diff --git a/mm/hugetlb.c b/mm/hugetlb.c index ae2959b..034617f 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1020,7 +1020,7 @@ static long region_chg(struct list_head *head, long f, long t) * size such that we can guarentee to record the reservation. */ if (&rg->link == head || t < rg->from) { nrg = kmalloc(sizeof(*nrg), GFP_KERNEL); - if (nrg == 0) + if (!nrg) return -ENOMEM; nrg->from = f; nrg->to = f; diff --git a/mm/mremap.c b/mm/mremap.c index 8ea5c24..08e3c7f 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -291,7 +291,7 @@ unsigned long do_mremap(unsigned long addr, if ((addr <= new_addr) && (addr+old_len) > new_addr) goto out; - ret = security_file_mmap(0, 0, 0, 0, new_addr, 1); + ret = security_file_mmap(NULL, 0, 0, 0, new_addr, 1); if (ret) goto out; @@ -399,7 +399,7 @@ unsigned long do_mremap(unsigned long addr, goto out; } - ret = security_file_mmap(0, 0, 0, 0, new_addr, 1); + ret = security_file_mmap(NULL, 0, 0, 0, new_addr, 1); if (ret) goto out; } diff --git a/mm/vmscan.c b/mm/vmscan.c index e147138..cb474cc 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1282,7 +1282,7 @@ out: */ if (priority < 0) priority = 0; - for (i = 0; zones[i] != 0; i++) { + for (i = 0; zones[i] != NULL; i++) { struct zone *zone = zones[i]; if (!cpuset_zone_allowed_hardwall(zone, GFP_KERNEL)) diff --git a/security/selinux/xfrm.c b/security/selinux/xfrm.c index cb008d9..36a191e 100644 --- a/security/selinux/xfrm.c +++ b/security/selinux/xfrm.c @@ -448,7 +448,7 @@ int selinux_xfrm_postroute_last(u32 isec_sid, struct sk_buff *skb, if (dst) { struct dst_entry *dst_test; - for (dst_test = dst; dst_test != 0; + for (dst_test = dst; dst_test != NULL; dst_test = dst_test->child) { struct xfrm_state *x = dst_test->xfrm; |