Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dcc50c8e authored by Artem Bityutskiy's avatar Artem Bityutskiy
Browse files

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: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
parent 8ca5175b
Loading
Loading
Loading
Loading
+10 −15
Original line number Original line Diff line number Diff line
@@ -1044,7 +1044,7 @@ static int scan_check_cb(struct ubifs_info *c,
		if (cat != (lp->flags & LPROPS_CAT_MASK)) {
		if (cat != (lp->flags & LPROPS_CAT_MASK)) {
			ubifs_err("bad LEB category %d expected %d",
			ubifs_err("bad LEB category %d expected %d",
				  (lp->flags & LPROPS_CAT_MASK), cat);
				  (lp->flags & LPROPS_CAT_MASK), cat);
			goto out;
			return -EINVAL;
		}
		}
	}
	}


@@ -1078,7 +1078,7 @@ static int scan_check_cb(struct ubifs_info *c,
			}
			}
			if (!found) {
			if (!found) {
				ubifs_err("bad LPT list (category %d)", cat);
				ubifs_err("bad LPT list (category %d)", cat);
				goto out;
				return -EINVAL;
			}
			}
		}
		}
	}
	}
@@ -1090,15 +1090,13 @@ static int scan_check_cb(struct ubifs_info *c,
		if ((lp->hpos != -1 && heap->arr[lp->hpos]->lnum != lnum) ||
		if ((lp->hpos != -1 && heap->arr[lp->hpos]->lnum != lnum) ||
		    lp != heap->arr[lp->hpos]) {
		    lp != heap->arr[lp->hpos]) {
			ubifs_err("bad LPT heap (category %d)", cat);
			ubifs_err("bad LPT heap (category %d)", cat);
			goto out;
			return -EINVAL;
		}
		}
	}
	}


	buf = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL);
	buf = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL);
	if (!buf) {
	if (!buf)
		ubifs_err("cannot allocate memory to scan LEB %d", lnum);
		return -ENOMEM;
		goto out;
	}


	/*
	/*
	 * After an unclean unmount, empty and freeable LEBs
	 * After an unclean unmount, empty and freeable LEBs
@@ -1120,9 +1118,8 @@ static int scan_check_cb(struct ubifs_info *c,


	sleb = ubifs_scan(c, lnum, 0, buf, 0);
	sleb = ubifs_scan(c, lnum, 0, buf, 0);
	if (IS_ERR(sleb)) {
	if (IS_ERR(sleb)) {
		data->err = PTR_ERR(sleb);
		ret = PTR_ERR(sleb);
		ret = LPT_SCAN_STOP;
		goto out;
		goto exit;
	}
	}


	is_idx = -1;
	is_idx = -1;
@@ -1240,10 +1237,8 @@ static int scan_check_cb(struct ubifs_info *c,
	}
	}


	ubifs_scan_destroy(sleb);
	ubifs_scan_destroy(sleb);
	ret = LPT_SCAN_CONTINUE;
exit:
	vfree(buf);
	vfree(buf);
	return ret;
	return LPT_SCAN_CONTINUE;


out_print:
out_print:
	ubifs_err("bad accounting of LEB %d: free %d, dirty %d flags %#x, "
	ubifs_err("bad accounting of LEB %d: free %d, dirty %d flags %#x, "
@@ -1252,10 +1247,10 @@ static int scan_check_cb(struct ubifs_info *c,
	dbg_dump_leb(c, lnum);
	dbg_dump_leb(c, lnum);
out_destroy:
out_destroy:
	ubifs_scan_destroy(sleb);
	ubifs_scan_destroy(sleb);
	ret = -EINVAL;
out:
out:
	vfree(buf);
	vfree(buf);
	data->err = -EINVAL;
	return ret;
	return LPT_SCAN_STOP;
}
}


/**
/**