Skip to content

Commit 7dc5761

Browse files
PeterHuewetytso
authored andcommitted
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>
1 parent da48894 commit 7dc5761

7 files changed

Lines changed: 23 additions & 23 deletions

File tree

‎fs/ext4/extents.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode,
10341034
for (i = 0; i < depth; i++) {
10351035
if (!ablocks[i])
10361036
continue;
1037-
ext4_free_blocks(handle, inode, 0, ablocks[i], 1,
1037+
ext4_free_blocks(handle, inode, NULL, ablocks[i], 1,
10381038
EXT4_FREE_BLOCKS_METADATA);
10391039
}
10401040
}
@@ -2059,7 +2059,7 @@ static int ext4_ext_rm_idx(handle_t *handle, struct inode *inode,
20592059
if (err)
20602060
return err;
20612061
ext_debug("index is empty, remove it, free block %llu\n", leaf);
2062-
ext4_free_blocks(handle, inode, 0, leaf, 1,
2062+
ext4_free_blocks(handle, inode, NULL, leaf, 1,
20632063
EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_FORGET);
20642064
return err;
20652065
}
@@ -2156,7 +2156,7 @@ static int ext4_remove_blocks(handle_t *handle, struct inode *inode,
21562156
num = le32_to_cpu(ex->ee_block) + ee_len - from;
21572157
start = ext4_ext_pblock(ex) + ee_len - num;
21582158
ext_debug("free last %u blocks starting %llu\n", num, start);
2159-
ext4_free_blocks(handle, inode, 0, start, num, flags);
2159+
ext4_free_blocks(handle, inode, NULL, start, num, flags);
21602160
} else if (from == le32_to_cpu(ex->ee_block)
21612161
&& to <= le32_to_cpu(ex->ee_block) + ee_len - 1) {
21622162
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,
34853485
/* not a good idea to call discard here directly,
34863486
* but otherwise we'd need to call it every free() */
34873487
ext4_discard_preallocations(inode);
3488-
ext4_free_blocks(handle, inode, 0, ext4_ext_pblock(&newex),
3488+
ext4_free_blocks(handle, inode, NULL, ext4_ext_pblock(&newex),
34893489
ext4_ext_get_actual_len(&newex), 0);
34903490
goto out2;
34913491
}

‎fs/ext4/ialloc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent,
649649
*group = parent_group + flex_size;
650650
if (*group > ngroups)
651651
*group = 0;
652-
return find_group_orlov(sb, parent, group, mode, 0);
652+
return find_group_orlov(sb, parent, group, mode, NULL);
653653
}
654654

655655
/*

‎fs/ext4/inode.c‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ static int ext4_alloc_blocks(handle_t *handle, struct inode *inode,
720720
return ret;
721721
failed_out:
722722
for (i = 0; i < index; i++)
723-
ext4_free_blocks(handle, inode, 0, new_blocks[i], 1, 0);
723+
ext4_free_blocks(handle, inode, NULL, new_blocks[i], 1, 0);
724724
return ret;
725725
}
726726

@@ -823,20 +823,20 @@ static int ext4_alloc_branch(handle_t *handle, struct inode *inode,
823823
return err;
824824
failed:
825825
/* Allocation failed, free what we already allocated */
826-
ext4_free_blocks(handle, inode, 0, new_blocks[0], 1, 0);
826+
ext4_free_blocks(handle, inode, NULL, new_blocks[0], 1, 0);
827827
for (i = 1; i <= n ; i++) {
828828
/*
829829
* branch[i].bh is newly allocated, so there is no
830830
* need to revoke the block, which is why we don't
831831
* need to set EXT4_FREE_BLOCKS_METADATA.
832832
*/
833-
ext4_free_blocks(handle, inode, 0, new_blocks[i], 1,
833+
ext4_free_blocks(handle, inode, NULL, new_blocks[i], 1,
834834
EXT4_FREE_BLOCKS_FORGET);
835835
}
836836
for (i = n+1; i < indirect_blks; i++)
837-
ext4_free_blocks(handle, inode, 0, new_blocks[i], 1, 0);
837+
ext4_free_blocks(handle, inode, NULL, new_blocks[i], 1, 0);
838838

839-
ext4_free_blocks(handle, inode, 0, new_blocks[i], num, 0);
839+
ext4_free_blocks(handle, inode, NULL, new_blocks[i], num, 0);
840840

841841
return err;
842842
}
@@ -924,7 +924,7 @@ static int ext4_splice_branch(handle_t *handle, struct inode *inode,
924924
ext4_free_blocks(handle, inode, where[i].bh, 0, 1,
925925
EXT4_FREE_BLOCKS_FORGET);
926926
}
927-
ext4_free_blocks(handle, inode, 0, le32_to_cpu(where[num].key),
927+
ext4_free_blocks(handle, inode, NULL, le32_to_cpu(where[num].key),
928928
blks, 0);
929929

930930
return err;
@@ -4228,7 +4228,7 @@ static int ext4_clear_blocks(handle_t *handle, struct inode *inode,
42284228
for (p = first; p < last; p++)
42294229
*p = 0;
42304230

4231-
ext4_free_blocks(handle, inode, 0, block_to_free, count, flags);
4231+
ext4_free_blocks(handle, inode, NULL, block_to_free, count, flags);
42324232
return 0;
42334233
}
42344234

@@ -4416,7 +4416,7 @@ static void ext4_free_branches(handle_t *handle, struct inode *inode,
44164416
* transaction where the data blocks are
44174417
* actually freed.
44184418
*/
4419-
ext4_free_blocks(handle, inode, 0, nr, 1,
4419+
ext4_free_blocks(handle, inode, NULL, nr, 1,
44204420
EXT4_FREE_BLOCKS_METADATA|
44214421
EXT4_FREE_BLOCKS_FORGET);
44224422

@@ -4875,7 +4875,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
48754875
return inode;
48764876

48774877
ei = EXT4_I(inode);
4878-
iloc.bh = 0;
4878+
iloc.bh = NULL;
48794879

48804880
ret = __ext4_get_inode_loc(inode, &iloc, 0);
48814881
if (ret < 0)

‎fs/ext4/migrate.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,15 +263,15 @@ static int free_dind_blocks(handle_t *handle,
263263
for (i = 0; i < max_entries; i++) {
264264
if (tmp_idata[i]) {
265265
extend_credit_for_blkdel(handle, inode);
266-
ext4_free_blocks(handle, inode, 0,
266+
ext4_free_blocks(handle, inode, NULL,
267267
le32_to_cpu(tmp_idata[i]), 1,
268268
EXT4_FREE_BLOCKS_METADATA |
269269
EXT4_FREE_BLOCKS_FORGET);
270270
}
271271
}
272272
put_bh(bh);
273273
extend_credit_for_blkdel(handle, inode);
274-
ext4_free_blocks(handle, inode, 0, le32_to_cpu(i_data), 1,
274+
ext4_free_blocks(handle, inode, NULL, le32_to_cpu(i_data), 1,
275275
EXT4_FREE_BLOCKS_METADATA |
276276
EXT4_FREE_BLOCKS_FORGET);
277277
return 0;
@@ -302,7 +302,7 @@ static int free_tind_blocks(handle_t *handle,
302302
}
303303
put_bh(bh);
304304
extend_credit_for_blkdel(handle, inode);
305-
ext4_free_blocks(handle, inode, 0, le32_to_cpu(i_data), 1,
305+
ext4_free_blocks(handle, inode, NULL, le32_to_cpu(i_data), 1,
306306
EXT4_FREE_BLOCKS_METADATA |
307307
EXT4_FREE_BLOCKS_FORGET);
308308
return 0;
@@ -315,7 +315,7 @@ static int free_ind_block(handle_t *handle, struct inode *inode, __le32 *i_data)
315315
/* ei->i_data[EXT4_IND_BLOCK] */
316316
if (i_data[0]) {
317317
extend_credit_for_blkdel(handle, inode);
318-
ext4_free_blocks(handle, inode, 0,
318+
ext4_free_blocks(handle, inode, NULL,
319319
le32_to_cpu(i_data[0]), 1,
320320
EXT4_FREE_BLOCKS_METADATA |
321321
EXT4_FREE_BLOCKS_FORGET);
@@ -428,7 +428,7 @@ static int free_ext_idx(handle_t *handle, struct inode *inode,
428428
}
429429
put_bh(bh);
430430
extend_credit_for_blkdel(handle, inode);
431-
ext4_free_blocks(handle, inode, 0, block, 1,
431+
ext4_free_blocks(handle, inode, NULL, block, 1,
432432
EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_FORGET);
433433
return retval;
434434
}

‎fs/ext4/page-io.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,9 @@ void ext4_io_submit(struct ext4_io_submit *io)
279279
BUG_ON(bio_flagged(io->io_bio, BIO_EOPNOTSUPP));
280280
bio_put(io->io_bio);
281281
}
282-
io->io_bio = 0;
282+
io->io_bio = NULL;
283283
io->io_op = 0;
284-
io->io_end = 0;
284+
io->io_end = NULL;
285285
}
286286

287287
static int io_submit_init(struct ext4_io_submit *io,

‎fs/ext4/super.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1451,7 +1451,7 @@ static int parse_options(char *options, struct super_block *sb,
14511451
* Initialize args struct so we know whether arg was
14521452
* found; some options take optional arguments.
14531453
*/
1454-
args[0].to = args[0].from = 0;
1454+
args[0].to = args[0].from = NULL;
14551455
token = match_token(p, tokens, args);
14561456
switch (token) {
14571457
case Opt_bsd_df:

‎fs/ext4/xattr.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
833833
new_bh = sb_getblk(sb, block);
834834
if (!new_bh) {
835835
getblk_failed:
836-
ext4_free_blocks(handle, inode, 0, block, 1,
836+
ext4_free_blocks(handle, inode, NULL, block, 1,
837837
EXT4_FREE_BLOCKS_METADATA);
838838
error = -EIO;
839839
goto cleanup;

0 commit comments

Comments
 (0)