From: Charles Manning Date: Tue, 4 Mar 2014 01:11:14 +0000 (+1300) Subject: Merge branch 'master' of ssh://www.aleph1.co.uk/home/aleph1/git/yaffs2 X-Git-Tag: aleph1-release~44 X-Git-Url: https://yaffs.net/gitweb/?p=yaffs2.git;a=commitdiff_plain;h=aaae578baf773ae9d41415cf7eaec457f6690e57;hp=413797fe98ba5f4ba219c8628273eea918eb8655 Merge branch 'master' of ssh://aleph1.co.uk/home/aleph1/git/yaffs2 --- diff --git a/yaffs_vfs_multi.c b/yaffs_vfs_multi.c index 67050d4..f767315 100644 --- a/yaffs_vfs_multi.c +++ b/yaffs_vfs_multi.c @@ -2670,7 +2670,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version, /* Get the device */ mtd = get_mtd_device(NULL, MINOR(sb->s_dev)); - if (!mtd) { + if (IS_ERR(mtd)) { yaffs_trace(YAFFS_TRACE_ALWAYS, "yaffs: MTD device %u either not valid or unavailable", MINOR(sb->s_dev)); @@ -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." diff --git a/yaffs_vfs_single.c b/yaffs_vfs_single.c index 145517b..232dc26 100644 --- a/yaffs_vfs_single.c +++ b/yaffs_vfs_single.c @@ -2033,7 +2033,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version, /* Get the device */ mtd = get_mtd_device(NULL, MINOR(sb->s_dev)); - if (!mtd) { + if (IS_ERR(mtd)) { yaffs_trace(YAFFS_TRACE_ALWAYS, "MTD device #%u doesn't appear to exist", MINOR(sb->s_dev)); @@ -2127,9 +2127,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version, 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 yaffs_dev");