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

Commit d4031259 authored by Andreas Gruenbacher's avatar Andreas Gruenbacher
Browse files

gfs2: Minor gfs2_alloc_inode cleanup



In gfs2_alloc_inode, when kmem_cache_alloc cannot allocate a new object, return
NULL immediately.  The code currently relies on the fact that i_inode is the
first member in struct gfs2_inode and so ip and &ip->i_inode evaluate to the
same address, but that isn't immediately obvious.

Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: default avatarBob Peterson <rpeterso@redhat.com>
parent 2257e468
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -1722,13 +1722,13 @@ static struct inode *gfs2_alloc_inode(struct super_block *sb)
	struct gfs2_inode *ip;

	ip = kmem_cache_alloc(gfs2_inode_cachep, GFP_KERNEL);
	if (ip) {
	if (!ip)
		return NULL;
	ip->i_flags = 0;
	ip->i_gl = NULL;
	memset(&ip->i_res, 0, sizeof(ip->i_res));
	RB_CLEAR_NODE(&ip->i_res.rs_node);
	ip->i_rahead = 0;
	}
	return &ip->i_inode;
}