/* This function returns volume table contents in case of success and a negative error code in case of failure.  */
static struct ubi_vtbl_record* create_empty_lvol(struct ubi_device *ubi, struct ubi_attach_info *ai)
/* This function returns volume table contents in case of success and a negative error code in case of failure.  */
static struct ubi_vtbl_record* create_empty_lvol(struct ubi_device *ubi, struct ubi_attach_info *ai)
{
	int i;
	struct ubi_vtbl_record *vtbl;
	vtbl = vzalloc(ubi->vtbl_size);
	if (!vtbl)
		return ERR_PTR(-ENOMEM);
	for (i = 0; i < ubi->vtbl_slots; i++)
		memcpy(&vtbl[i], &empty_vtbl_record, UBI_VTBL_RECORD_SIZE);
	for (i = 0; i < UBI_LAYOUT_VOLUME_EBS; i++) {
		int err;
		err = create_vtbl(ubi, ai, i, vtbl);
		if (err) {
			vfree(vtbl);
			return ERR_PTR(err);
		}
	}
	return vtbl;
}