/* This function returns zero in case of success and a negative error code in case of failure.  */
static int add_replay_bud(struct ubifs_info *c, int lnum, int offs, int jhead, unsigned long long sqnum)
/* This function returns zero in case of success and a negative error code in case of failure.  */
static int add_replay_bud(struct ubifs_info *c, int lnum, int offs, int jhead, unsigned long long sqnum)
{
	struct ubifs_bud *bud;
	struct bud_entry *b;
	dbg_mnt("add replay bud LEB %d:%d, head %d", lnum, offs, jhead);
	bud = kmalloc(sizeof(struct ubifs_bud), GFP_KERNEL);
	if (!bud)
		return -ENOMEM;
	b = kmalloc(sizeof(struct bud_entry), GFP_KERNEL);
	if (!b) {
		kfree(bud);
		return -ENOMEM;
	}
	bud->lnum = lnum;
	bud->start = offs;
	bud->jhead = jhead;
	ubifs_add_bud(c, bud);
	b->bud = bud;
	b->sqnum = sqnum;
	list_add_tail(&b->list, &c->replay_buds);
	return 0;
}