aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-05-06 13:47:14 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-05-16 03:31:38 -0400
commitdcc50c8ee334d570cef84fc956084d567f32a8a3 (patch)
tree3a8a7709df4084a82348279babd29139cd229873 /fs
parent8ca5175b02b77178a70cbb9fd7020c4938e3d3a6 (diff)
UBIFS: simplify error path in lprops debugging check
Simplify error path in 'scan_check_cb()' and stop using the special 'data->err' field, but instead return the error code directly. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/ubifs/lprops.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/fs/ubifs/lprops.c b/fs/ubifs/lprops.c
index ce9fe3933d16..ac4521ab2798 100644
--- a/fs/ubifs/lprops.c
+++ b/fs/ubifs/lprops.c
@@ -1044,7 +1044,7 @@ static int scan_check_cb(struct ubifs_info *c,
1044 if (cat != (lp->flags & LPROPS_CAT_MASK)) { 1044 if (cat != (lp->flags & LPROPS_CAT_MASK)) {
1045 ubifs_err("bad LEB category %d expected %d", 1045 ubifs_err("bad LEB category %d expected %d",
1046 (lp->flags & LPROPS_CAT_MASK), cat); 1046 (lp->flags & LPROPS_CAT_MASK), cat);
1047 goto out; 1047 return -EINVAL;
1048 } 1048 }
1049 } 1049 }
1050 1050
@@ -1078,7 +1078,7 @@ static int scan_check_cb(struct ubifs_info *c,
1078 } 1078 }
1079 if (!found) { 1079 if (!found) {
1080 ubifs_err("bad LPT list (category %d)", cat); 1080 ubifs_err("bad LPT list (category %d)", cat);
1081 goto out; 1081 return -EINVAL;
1082 } 1082 }
1083 } 1083 }
1084 } 1084 }
@@ -1090,15 +1090,13 @@ static int scan_check_cb(struct ubifs_info *c,
1090 if ((lp->hpos != -1 && heap->arr[lp->hpos]->lnum != lnum) || 1090 if ((lp->hpos != -1 && heap->arr[lp->hpos]->lnum != lnum) ||
1091 lp != heap->arr[lp->hpos]) { 1091 lp != heap->arr[lp->hpos]) {
1092 ubifs_err("bad LPT heap (category %d)", cat); 1092 ubifs_err("bad LPT heap (category %d)", cat);
1093 goto out; 1093 return -EINVAL;
1094 } 1094 }
1095 } 1095 }
1096 1096
1097 buf = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL); 1097 buf = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL);
1098 if (!buf) { 1098 if (!buf)
1099 ubifs_err("cannot allocate memory to scan LEB %d", lnum); 1099 return -ENOMEM;
1100 goto out;
1101 }
1102 1100
1103 /* 1101 /*
1104 * After an unclean unmount, empty and freeable LEBs 1102 * After an unclean unmount, empty and freeable LEBs
@@ -1120,9 +1118,8 @@ static int scan_check_cb(struct ubifs_info *c,
1120 1118
1121 sleb = ubifs_scan(c, lnum, 0, buf, 0); 1119 sleb = ubifs_scan(c, lnum, 0, buf, 0);
1122 if (IS_ERR(sleb)) { 1120 if (IS_ERR(sleb)) {
1123 data->err = PTR_ERR(sleb); 1121 ret = PTR_ERR(sleb);
1124 ret = LPT_SCAN_STOP; 1122 goto out;
1125 goto exit;
1126 } 1123 }
1127 1124
1128 is_idx = -1; 1125 is_idx = -1;
@@ -1240,10 +1237,8 @@ static int scan_check_cb(struct ubifs_info *c,
1240 } 1237 }
1241 1238
1242 ubifs_scan_destroy(sleb); 1239 ubifs_scan_destroy(sleb);
1243 ret = LPT_SCAN_CONTINUE;
1244exit:
1245 vfree(buf); 1240 vfree(buf);
1246 return ret; 1241 return LPT_SCAN_CONTINUE;
1247 1242
1248out_print: 1243out_print:
1249 ubifs_err("bad accounting of LEB %d: free %d, dirty %d flags %#x, " 1244 ubifs_err("bad accounting of LEB %d: free %d, dirty %d flags %#x, "
@@ -1252,10 +1247,10 @@ out_print:
1252 dbg_dump_leb(c, lnum); 1247 dbg_dump_leb(c, lnum);
1253out_destroy: 1248out_destroy:
1254 ubifs_scan_destroy(sleb); 1249 ubifs_scan_destroy(sleb);
1250 ret = -EINVAL;
1255out: 1251out:
1256 vfree(buf); 1252 vfree(buf);
1257 data->err = -EINVAL; 1253 return ret;
1258 return LPT_SCAN_STOP;
1259} 1254}
1260 1255
1261/** 1256/**