diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2011-11-08 09:04:20 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2011-11-08 09:04:20 -0500 |
commit | 87654896ca619ff64f94d3881d6bd0ec7b29e25f (patch) | |
tree | d5f19dca46c1d6aaa20a3a13acfe739eec0cc203 /fs | |
parent | dfe4d34b39b80faff52489f950a18523da7581bf (diff) |
GFS2: More automated code analysis fixes
A potentially uninitialised variable, some unreachable code,
and the main part of this, fixing the error path in the
unlink function.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/gfs2/bmap.c | 3 | ||||
-rw-r--r-- | fs/gfs2/file.c | 2 | ||||
-rw-r--r-- | fs/gfs2/inode.c | 9 |
3 files changed, 7 insertions, 7 deletions
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index 41d494d79709..f6be14f9ec14 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c | |||
@@ -743,9 +743,6 @@ static int do_strip(struct gfs2_inode *ip, struct buffer_head *dibh, | |||
743 | else if (ip->i_depth) | 743 | else if (ip->i_depth) |
744 | revokes = sdp->sd_inptrs; | 744 | revokes = sdp->sd_inptrs; |
745 | 745 | ||
746 | if (error) | ||
747 | return error; | ||
748 | |||
749 | memset(&rlist, 0, sizeof(struct gfs2_rgrp_list)); | 746 | memset(&rlist, 0, sizeof(struct gfs2_rgrp_list)); |
750 | bstart = 0; | 747 | bstart = 0; |
751 | blen = 0; | 748 | blen = 0; |
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 46f6f9ac1ebc..6336bc6bf458 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c | |||
@@ -609,7 +609,7 @@ static int gfs2_fsync(struct file *file, loff_t start, loff_t end, | |||
609 | struct inode *inode = mapping->host; | 609 | struct inode *inode = mapping->host; |
610 | int sync_state = inode->i_state & (I_DIRTY_SYNC|I_DIRTY_DATASYNC); | 610 | int sync_state = inode->i_state & (I_DIRTY_SYNC|I_DIRTY_DATASYNC); |
611 | struct gfs2_inode *ip = GFS2_I(inode); | 611 | struct gfs2_inode *ip = GFS2_I(inode); |
612 | int ret, ret1 = 0; | 612 | int ret = 0, ret1 = 0; |
613 | 613 | ||
614 | if (mapping->nrpages) { | 614 | if (mapping->nrpages) { |
615 | ret1 = filemap_fdatawrite_range(mapping, start, end); | 615 | ret1 = filemap_fdatawrite_range(mapping, start, end); |
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index cfd4959b218c..377920d3c430 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -1037,12 +1037,14 @@ static int gfs2_unlink(struct inode *dir, struct dentry *dentry) | |||
1037 | struct buffer_head *bh; | 1037 | struct buffer_head *bh; |
1038 | struct gfs2_holder ghs[3]; | 1038 | struct gfs2_holder ghs[3]; |
1039 | struct gfs2_rgrpd *rgd; | 1039 | struct gfs2_rgrpd *rgd; |
1040 | int error; | 1040 | int error = -EROFS; |
1041 | 1041 | ||
1042 | gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs); | 1042 | gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs); |
1043 | gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + 1); | 1043 | gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + 1); |
1044 | 1044 | ||
1045 | rgd = gfs2_blk2rgrpd(sdp, ip->i_no_addr); | 1045 | rgd = gfs2_blk2rgrpd(sdp, ip->i_no_addr); |
1046 | if (!rgd) | ||
1047 | goto out_inodes; | ||
1046 | gfs2_holder_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, ghs + 2); | 1048 | gfs2_holder_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, ghs + 2); |
1047 | 1049 | ||
1048 | 1050 | ||
@@ -1088,12 +1090,13 @@ out_end_trans: | |||
1088 | out_gunlock: | 1090 | out_gunlock: |
1089 | gfs2_glock_dq(ghs + 2); | 1091 | gfs2_glock_dq(ghs + 2); |
1090 | out_rgrp: | 1092 | out_rgrp: |
1091 | gfs2_holder_uninit(ghs + 2); | ||
1092 | gfs2_glock_dq(ghs + 1); | 1093 | gfs2_glock_dq(ghs + 1); |
1093 | out_child: | 1094 | out_child: |
1094 | gfs2_holder_uninit(ghs + 1); | ||
1095 | gfs2_glock_dq(ghs); | 1095 | gfs2_glock_dq(ghs); |
1096 | out_parent: | 1096 | out_parent: |
1097 | gfs2_holder_uninit(ghs + 2); | ||
1098 | out_inodes: | ||
1099 | gfs2_holder_uninit(ghs + 1); | ||
1097 | gfs2_holder_uninit(ghs); | 1100 | gfs2_holder_uninit(ghs); |
1098 | return error; | 1101 | return error; |
1099 | } | 1102 | } |