Skip to content

Commit 09aaa74

Browse files
JoePerchesDave Kleikamp
authored andcommitted
JFS: Remove defconfig ptr comparison to 0
Remove sparse warning: Using plain integer as NULL pointer Signed-off-by: Joe Perches <[email protected]> Signed-off-by: Dave Kleikamp <[email protected]>
1 parent a7fe0ba commit 09aaa74

File tree

5 files changed

+15
-14
lines changed

5 files changed

+15
-14
lines changed

fs/jfs/jfs_dtree.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -284,11 +284,11 @@ static struct dir_table_slot *find_index(struct inode *ip, u32 index,
284284
release_metapage(*mp);
285285
*mp = NULL;
286286
}
287-
if (*mp == 0) {
287+
if (!(*mp)) {
288288
*lblock = blkno;
289289
*mp = read_index_page(ip, blkno);
290290
}
291-
if (*mp == 0) {
291+
if (!(*mp)) {
292292
jfs_err("free_index: error reading directory table");
293293
return NULL;
294294
}
@@ -413,7 +413,8 @@ static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot)
413413
}
414414
ip->i_size = PSIZE;
415415

416-
if ((mp = get_index_page(ip, 0)) == 0) {
416+
mp = get_index_page(ip, 0);
417+
if (!mp) {
417418
jfs_err("add_index: get_metapage failed!");
418419
xtTruncate(tid, ip, 0, COMMIT_PWMAP);
419420
memcpy(&jfs_ip->i_dirtable, temp_table,
@@ -461,7 +462,7 @@ static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot)
461462
} else
462463
mp = read_index_page(ip, blkno);
463464

464-
if (mp == 0) {
465+
if (!mp) {
465466
jfs_err("add_index: get/read_metapage failed!");
466467
goto clean_up;
467468
}
@@ -499,7 +500,7 @@ static void free_index(tid_t tid, struct inode *ip, u32 index, u32 next)
499500

500501
dirtab_slot = find_index(ip, index, &mp, &lblock);
501502

502-
if (dirtab_slot == 0)
503+
if (!dirtab_slot)
503504
return;
504505

505506
dirtab_slot->flag = DIR_INDEX_FREE;
@@ -526,7 +527,7 @@ static void modify_index(tid_t tid, struct inode *ip, u32 index, s64 bn,
526527

527528
dirtab_slot = find_index(ip, index, mp, lblock);
528529

529-
if (dirtab_slot == 0)
530+
if (!dirtab_slot)
530531
return;
531532

532533
DTSaddress(dirtab_slot, bn);
@@ -552,7 +553,7 @@ static int read_index(struct inode *ip, u32 index,
552553
struct dir_table_slot *slot;
553554

554555
slot = find_index(ip, index, &mp, &lblock);
555-
if (slot == 0) {
556+
if (!slot) {
556557
return -EIO;
557558
}
558559

@@ -593,7 +594,7 @@ int dtSearch(struct inode *ip, struct component_name * key, ino_t * data,
593594
struct super_block *sb = ip->i_sb;
594595

595596
ciKey.name = kmalloc((JFS_NAME_MAX + 1) * sizeof(wchar_t), GFP_NOFS);
596-
if (ciKey.name == 0) {
597+
if (!ciKey.name) {
597598
rc = -ENOMEM;
598599
goto dtSearch_Exit2;
599600
}
@@ -956,7 +957,7 @@ static int dtSplitUp(tid_t tid,
956957
sp = DT_PAGE(ip, smp);
957958

958959
key.name = kmalloc((JFS_NAME_MAX + 2) * sizeof(wchar_t), GFP_NOFS);
959-
if (key.name == 0) {
960+
if (!key.name) {
960961
DT_PUTPAGE(smp);
961962
rc = -ENOMEM;
962963
goto dtSplitUp_Exit;

fs/jfs/jfs_imap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ int diRead(struct inode *ip)
381381

382382
/* read the page of disk inode */
383383
mp = read_metapage(ipimap, pageno << sbi->l2nbperpage, PSIZE, 1);
384-
if (mp == 0) {
384+
if (!mp) {
385385
jfs_err("diRead: read_metapage failed");
386386
return -EIO;
387387
}
@@ -654,7 +654,7 @@ int diWrite(tid_t tid, struct inode *ip)
654654
/* read the page of disk inode */
655655
retry:
656656
mp = read_metapage(ipimap, pageno << sbi->l2nbperpage, PSIZE, 1);
657-
if (mp == 0)
657+
if (!mp)
658658
return -EIO;
659659

660660
/* get the pointer to the disk inode */

fs/jfs/jfs_logmgr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2345,7 +2345,7 @@ int jfsIOWait(void *arg)
23452345

23462346
do {
23472347
spin_lock_irq(&log_redrive_lock);
2348-
while ((bp = log_redrive_list) != 0) {
2348+
while ((bp = log_redrive_list)) {
23492349
log_redrive_list = bp->l_redrive_next;
23502350
bp->l_redrive_next = NULL;
23512351
spin_unlock_irq(&log_redrive_lock);

fs/jfs/jfs_mount.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ int jfs_mount(struct super_block *sb)
147147
*/
148148
if ((sbi->mntflag & JFS_BAD_SAIT) == 0) {
149149
ipaimap2 = diReadSpecial(sb, AGGREGATE_I, 1);
150-
if (ipaimap2 == 0) {
150+
if (!ipaimap2) {
151151
jfs_err("jfs_mount: Faild to read AGGREGATE_I");
152152
rc = -EIO;
153153
goto errout35;

fs/jfs/namei.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
11031103
* Make sure dest inode number (if any) is what we think it is
11041104
*/
11051105
rc = dtSearch(new_dir, &new_dname, &ino, &btstack, JFS_LOOKUP);
1106-
if (rc == 0) {
1106+
if (!rc) {
11071107
if ((new_ip == 0) || (ino != new_ip->i_ino)) {
11081108
rc = -ESTALE;
11091109
goto out3;

0 commit comments

Comments
 (0)