ext4: Fix sparse warning: Using plain integer as NULL pointer

This patch fixes the warning "Using plain integer as NULL pointer",
generated by sparse, by replacing the offending 0s with NULL.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
This commit is contained in:
Peter Huewe 2011-02-21 21:01:42 -05:00 committed by Theodore Ts'o
parent da488945f4
commit 7dc576158d
7 changed files with 23 additions and 23 deletions

View File

@ -1034,7 +1034,7 @@ cleanup:
for (i = 0; i < depth; i++) { for (i = 0; i < depth; i++) {
if (!ablocks[i]) if (!ablocks[i])
continue; continue;
ext4_free_blocks(handle, inode, 0, ablocks[i], 1, ext4_free_blocks(handle, inode, NULL, ablocks[i], 1,
EXT4_FREE_BLOCKS_METADATA); EXT4_FREE_BLOCKS_METADATA);
} }
} }
@ -2059,7 +2059,7 @@ static int ext4_ext_rm_idx(handle_t *handle, struct inode *inode,
if (err) if (err)
return err; return err;
ext_debug("index is empty, remove it, free block %llu\n", leaf); ext_debug("index is empty, remove it, free block %llu\n", leaf);
ext4_free_blocks(handle, inode, 0, leaf, 1, ext4_free_blocks(handle, inode, NULL, leaf, 1,
EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_FORGET); EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_FORGET);
return err; return err;
} }
@ -2156,7 +2156,7 @@ static int ext4_remove_blocks(handle_t *handle, struct inode *inode,
num = le32_to_cpu(ex->ee_block) + ee_len - from; num = le32_to_cpu(ex->ee_block) + ee_len - from;
start = ext4_ext_pblock(ex) + ee_len - num; start = ext4_ext_pblock(ex) + ee_len - num;
ext_debug("free last %u blocks starting %llu\n", num, start); ext_debug("free last %u blocks starting %llu\n", num, start);
ext4_free_blocks(handle, inode, 0, start, num, flags); ext4_free_blocks(handle, inode, NULL, start, num, flags);
} else if (from == le32_to_cpu(ex->ee_block) } else if (from == le32_to_cpu(ex->ee_block)
&& to <= le32_to_cpu(ex->ee_block) + ee_len - 1) { && to <= le32_to_cpu(ex->ee_block) + ee_len - 1) {
printk(KERN_INFO "strange request: removal %u-%u from %u:%u\n", printk(KERN_INFO "strange request: removal %u-%u from %u:%u\n",
@ -3485,7 +3485,7 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
/* not a good idea to call discard here directly, /* not a good idea to call discard here directly,
* but otherwise we'd need to call it every free() */ * but otherwise we'd need to call it every free() */
ext4_discard_preallocations(inode); ext4_discard_preallocations(inode);
ext4_free_blocks(handle, inode, 0, ext4_ext_pblock(&newex), ext4_free_blocks(handle, inode, NULL, ext4_ext_pblock(&newex),
ext4_ext_get_actual_len(&newex), 0); ext4_ext_get_actual_len(&newex), 0);
goto out2; goto out2;
} }

View File

@ -649,7 +649,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent,
*group = parent_group + flex_size; *group = parent_group + flex_size;
if (*group > ngroups) if (*group > ngroups)
*group = 0; *group = 0;
return find_group_orlov(sb, parent, group, mode, 0); return find_group_orlov(sb, parent, group, mode, NULL);
} }
/* /*

View File

@ -720,7 +720,7 @@ allocated:
return ret; return ret;
failed_out: failed_out:
for (i = 0; i < index; i++) for (i = 0; i < index; i++)
ext4_free_blocks(handle, inode, 0, new_blocks[i], 1, 0); ext4_free_blocks(handle, inode, NULL, new_blocks[i], 1, 0);
return ret; return ret;
} }
@ -823,20 +823,20 @@ static int ext4_alloc_branch(handle_t *handle, struct inode *inode,
return err; return err;
failed: failed:
/* Allocation failed, free what we already allocated */ /* Allocation failed, free what we already allocated */
ext4_free_blocks(handle, inode, 0, new_blocks[0], 1, 0); ext4_free_blocks(handle, inode, NULL, new_blocks[0], 1, 0);
for (i = 1; i <= n ; i++) { for (i = 1; i <= n ; i++) {
/* /*
* branch[i].bh is newly allocated, so there is no * branch[i].bh is newly allocated, so there is no
* need to revoke the block, which is why we don't * need to revoke the block, which is why we don't
* need to set EXT4_FREE_BLOCKS_METADATA. * need to set EXT4_FREE_BLOCKS_METADATA.
*/ */
ext4_free_blocks(handle, inode, 0, new_blocks[i], 1, ext4_free_blocks(handle, inode, NULL, new_blocks[i], 1,
EXT4_FREE_BLOCKS_FORGET); EXT4_FREE_BLOCKS_FORGET);
} }
for (i = n+1; i < indirect_blks; i++) for (i = n+1; i < indirect_blks; i++)
ext4_free_blocks(handle, inode, 0, new_blocks[i], 1, 0); ext4_free_blocks(handle, inode, NULL, new_blocks[i], 1, 0);
ext4_free_blocks(handle, inode, 0, new_blocks[i], num, 0); ext4_free_blocks(handle, inode, NULL, new_blocks[i], num, 0);
return err; return err;
} }
@ -924,7 +924,7 @@ err_out:
ext4_free_blocks(handle, inode, where[i].bh, 0, 1, ext4_free_blocks(handle, inode, where[i].bh, 0, 1,
EXT4_FREE_BLOCKS_FORGET); EXT4_FREE_BLOCKS_FORGET);
} }
ext4_free_blocks(handle, inode, 0, le32_to_cpu(where[num].key), ext4_free_blocks(handle, inode, NULL, le32_to_cpu(where[num].key),
blks, 0); blks, 0);
return err; return err;
@ -4228,7 +4228,7 @@ static int ext4_clear_blocks(handle_t *handle, struct inode *inode,
for (p = first; p < last; p++) for (p = first; p < last; p++)
*p = 0; *p = 0;
ext4_free_blocks(handle, inode, 0, block_to_free, count, flags); ext4_free_blocks(handle, inode, NULL, block_to_free, count, flags);
return 0; return 0;
} }
@ -4416,7 +4416,7 @@ static void ext4_free_branches(handle_t *handle, struct inode *inode,
* transaction where the data blocks are * transaction where the data blocks are
* actually freed. * actually freed.
*/ */
ext4_free_blocks(handle, inode, 0, nr, 1, ext4_free_blocks(handle, inode, NULL, nr, 1,
EXT4_FREE_BLOCKS_METADATA| EXT4_FREE_BLOCKS_METADATA|
EXT4_FREE_BLOCKS_FORGET); EXT4_FREE_BLOCKS_FORGET);
@ -4875,7 +4875,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
return inode; return inode;
ei = EXT4_I(inode); ei = EXT4_I(inode);
iloc.bh = 0; iloc.bh = NULL;
ret = __ext4_get_inode_loc(inode, &iloc, 0); ret = __ext4_get_inode_loc(inode, &iloc, 0);
if (ret < 0) if (ret < 0)

View File

@ -263,7 +263,7 @@ static int free_dind_blocks(handle_t *handle,
for (i = 0; i < max_entries; i++) { for (i = 0; i < max_entries; i++) {
if (tmp_idata[i]) { if (tmp_idata[i]) {
extend_credit_for_blkdel(handle, inode); extend_credit_for_blkdel(handle, inode);
ext4_free_blocks(handle, inode, 0, ext4_free_blocks(handle, inode, NULL,
le32_to_cpu(tmp_idata[i]), 1, le32_to_cpu(tmp_idata[i]), 1,
EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_METADATA |
EXT4_FREE_BLOCKS_FORGET); EXT4_FREE_BLOCKS_FORGET);
@ -271,7 +271,7 @@ static int free_dind_blocks(handle_t *handle,
} }
put_bh(bh); put_bh(bh);
extend_credit_for_blkdel(handle, inode); extend_credit_for_blkdel(handle, inode);
ext4_free_blocks(handle, inode, 0, le32_to_cpu(i_data), 1, ext4_free_blocks(handle, inode, NULL, le32_to_cpu(i_data), 1,
EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_METADATA |
EXT4_FREE_BLOCKS_FORGET); EXT4_FREE_BLOCKS_FORGET);
return 0; return 0;
@ -302,7 +302,7 @@ static int free_tind_blocks(handle_t *handle,
} }
put_bh(bh); put_bh(bh);
extend_credit_for_blkdel(handle, inode); extend_credit_for_blkdel(handle, inode);
ext4_free_blocks(handle, inode, 0, le32_to_cpu(i_data), 1, ext4_free_blocks(handle, inode, NULL, le32_to_cpu(i_data), 1,
EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_METADATA |
EXT4_FREE_BLOCKS_FORGET); EXT4_FREE_BLOCKS_FORGET);
return 0; return 0;
@ -315,7 +315,7 @@ static int free_ind_block(handle_t *handle, struct inode *inode, __le32 *i_data)
/* ei->i_data[EXT4_IND_BLOCK] */ /* ei->i_data[EXT4_IND_BLOCK] */
if (i_data[0]) { if (i_data[0]) {
extend_credit_for_blkdel(handle, inode); extend_credit_for_blkdel(handle, inode);
ext4_free_blocks(handle, inode, 0, ext4_free_blocks(handle, inode, NULL,
le32_to_cpu(i_data[0]), 1, le32_to_cpu(i_data[0]), 1,
EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_METADATA |
EXT4_FREE_BLOCKS_FORGET); EXT4_FREE_BLOCKS_FORGET);
@ -428,7 +428,7 @@ static int free_ext_idx(handle_t *handle, struct inode *inode,
} }
put_bh(bh); put_bh(bh);
extend_credit_for_blkdel(handle, inode); extend_credit_for_blkdel(handle, inode);
ext4_free_blocks(handle, inode, 0, block, 1, ext4_free_blocks(handle, inode, NULL, block, 1,
EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_FORGET); EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_FORGET);
return retval; return retval;
} }

View File

@ -279,9 +279,9 @@ void ext4_io_submit(struct ext4_io_submit *io)
BUG_ON(bio_flagged(io->io_bio, BIO_EOPNOTSUPP)); BUG_ON(bio_flagged(io->io_bio, BIO_EOPNOTSUPP));
bio_put(io->io_bio); bio_put(io->io_bio);
} }
io->io_bio = 0; io->io_bio = NULL;
io->io_op = 0; io->io_op = 0;
io->io_end = 0; io->io_end = NULL;
} }
static int io_submit_init(struct ext4_io_submit *io, static int io_submit_init(struct ext4_io_submit *io,

View File

@ -1451,7 +1451,7 @@ static int parse_options(char *options, struct super_block *sb,
* Initialize args struct so we know whether arg was * Initialize args struct so we know whether arg was
* found; some options take optional arguments. * found; some options take optional arguments.
*/ */
args[0].to = args[0].from = 0; args[0].to = args[0].from = NULL;
token = match_token(p, tokens, args); token = match_token(p, tokens, args);
switch (token) { switch (token) {
case Opt_bsd_df: case Opt_bsd_df:

View File

@ -833,7 +833,7 @@ inserted:
new_bh = sb_getblk(sb, block); new_bh = sb_getblk(sb, block);
if (!new_bh) { if (!new_bh) {
getblk_failed: getblk_failed:
ext4_free_blocks(handle, inode, 0, block, 1, ext4_free_blocks(handle, inode, NULL, block, 1,
EXT4_FREE_BLOCKS_METADATA); EXT4_FREE_BLOCKS_METADATA);
error = -EIO; error = -EIO;
goto cleanup; goto cleanup;