Return from yaffs_internal_read_super if kmalloc fail
[yaffs2.git] / yaffs_vfs_multi.c
index 67050d4e3d2c1f7dd7b88a946567968a203ee251..27cc0c010d73b7ce6d934ad948fe6dae66eef21a 100644 (file)
@@ -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."