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");
}
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 = {
/* 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));
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");
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;
sb->s_maxbytes = yaffs_max_file_size(dev);
- yaffs_trace(YAFFS_TRACE_OS,
- "yaffs_readpage_nolock at %lld, size %08x",
- (long long)pos,
- (unsigned)PAGE_CACHE_SIZE);
/* Release lock before yaffs_get_inode() */
yaffs_gross_unlock(dev);