/* This function returns a pointer to the nnode on success or a negative error code on failure.  */
static struct ubifs_nnode* nnode_lookup(struct ubifs_info *c, int i)
/* This function returns a pointer to the nnode on success or a negative error code on failure.  */
static struct ubifs_nnode* nnode_lookup(struct ubifs_info *c, int i)
{
	int err, iip;
	struct ubifs_nnode *nnode;
	if (!c->nroot) {
		err = ubifs_read_nnode(c, NULL, 0);
		if (err)
			return ERR_PTR(err);
	}
	nnode = c->nroot;
	while (1) {
		iip = i & (UBIFS_LPT_FANOUT - 1);
		i >>= UBIFS_LPT_FANOUT_SHIFT;
		if (!i)
			break;
		nnode = ubifs_get_nnode(c, nnode, iip);
		if (IS_ERR(nnode))
			return nnode;
	}
	return nnode;
}