From: Kjetil Aamodt Date: Mon, 9 Sep 2013 13:24:52 +0000 (+0200) Subject: Return from yaffs_internal_read_super if kmalloc fail X-Git-Tag: aleph1-release~44^2~2 X-Git-Url: https://yaffs.net/gitweb/?p=yaffs2.git;a=commitdiff_plain;h=e72372f93c862b499f586006cd30a5052fde38f8 Return from yaffs_internal_read_super if kmalloc fail Return if either, or both, of dev and context failed to kmalloc(). kfree() handles NULL as argument so utilise that to simplify code. --- diff --git a/yaffs_vfs_multi.c b/yaffs_vfs_multi.c index 67050d4..27cc0c0 100644 --- a/yaffs_vfs_multi.c +++ b/yaffs_vfs_multi.c @@ -2713,15 +2713,11 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version, context = kmalloc(sizeof(struct yaffs_linux_context), GFP_KERNEL); if (!dev || !context) { - if (dev) - kfree(dev); - if (context) - kfree(context); + kfree(dev); + kfree(context); dev = NULL; context = NULL; - } - if (!dev) { /* Deep shit could not allocate device structure */ yaffs_trace(YAFFS_TRACE_ALWAYS, "yaffs_read_super: Failed trying to allocate struct yaffs_dev."