/* This function loads znode pointed to by @zbr into the TNC cache and returns pointer to it in case of success and a negative error code in case of failure.  */
struct ubifs_znode* ubifs_load_znode(struct ubifs_info *c, struct ubifs_zbranch *zbr, struct ubifs_znode *parent, int iip)
/* This function loads znode pointed to by @zbr into the TNC cache and returns pointer to it in case of success and a negative error code in case of failure.  */
struct ubifs_znode* ubifs_load_znode(struct ubifs_info *c, struct ubifs_zbranch *zbr, struct ubifs_znode *parent, int iip)
{
	int err;
	struct ubifs_znode *znode;
	ubifs_assert(!zbr->znode);
	znode = kzalloc(c->max_znode_sz, GFP_NOFS);
	if (!znode)
		return ERR_PTR(-ENOMEM);
	err = read_znode(c, zbr->lnum, zbr->offs, zbr->len, znode);
	if (err)
		goto out;
	zbr->znode = znode;
	znode->parent = parent;
	znode->time = get_seconds();
	znode->iip = iip;
	return znode;
out:
	kfree(znode);
	return ERR_PTR(err);
}