X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=blobdiff_plain;f=yaffs_vfs_single.c;h=232dc2625328a7173509456dcf227c7411d9da5b;hp=8d41f69a2b1f830028c060e08624a4e6dfcaa4ef;hb=4e188b08c5531f99f73383a85251e03a1e667b26;hpb=eb12d56bfe85288734475bb9374773fd560619d9 diff --git a/yaffs_vfs_single.c b/yaffs_vfs_single.c index 8d41f69..232dc26 100644 --- a/yaffs_vfs_single.c +++ b/yaffs_vfs_single.c @@ -1912,6 +1912,7 @@ static void yaffs_fill_inode_from_obj(struct inode *inode, static void yaffs_put_super(struct super_block *sb) { struct yaffs_dev *dev = yaffs_super_to_dev(sb); + struct mtd_info *mtd = yaffs_dev_to_mtd(dev); yaffs_trace(YAFFS_TRACE_OS, "yaffs_put_super"); @@ -1941,16 +1942,14 @@ static void yaffs_put_super(struct super_block *sb) } kfree(dev); -} -static void yaffs_mtd_put_super(struct super_block *sb) -{ - struct mtd_info *mtd = yaffs_dev_to_mtd(yaffs_super_to_dev(sb)); - if (mtd->sync) + + if (mtd && mtd->sync) mtd->sync(mtd); - put_mtd_device(mtd); + if (mtd) + put_mtd_device(mtd); } static const struct super_operations yaffs_super_ops = { @@ -2034,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)); @@ -2128,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"); @@ -2213,7 +2210,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version, yaffs_dev_to_lc(dev)->put_super_fn = yaffs_mtd_put_super; param->sb_dirty_fn = yaffs_touch_super; - param->gc_control = yaffs_gc_control_callback; + param->gc_control_fn = yaffs_gc_control_callback; yaffs_dev_to_lc(dev)->super = sb;