fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / fs / cramfs / inode.c
index 0e2294c..6db03fb 100644 (file)
@@ -241,11 +241,10 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent)
 
        sb->s_flags |= MS_RDONLY;
 
-       sbi = kmalloc(sizeof(struct cramfs_sb_info), GFP_KERNEL);
+       sbi = kzalloc(sizeof(struct cramfs_sb_info), GFP_KERNEL);
        if (!sbi)
                return -ENOMEM;
        sb->s_fs_info = sbi;
-       memset(sbi, 0, sizeof(struct cramfs_sb_info));
 
        /* Invalidate the read buffers on mount: think disk change.. */
        mutex_lock(&read_mutex);
@@ -339,7 +338,7 @@ static int cramfs_statfs(struct dentry *dentry, struct kstatfs *buf)
  */
 static int cramfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
 {
-       struct inode *inode = filp->f_dentry->d_inode;
+       struct inode *inode = filp->f_path.dentry->d_inode;
        struct super_block *sb = inode->i_sb;
        char *buf;
        unsigned int offset;
@@ -546,8 +545,15 @@ static struct file_system_type cramfs_fs_type = {
 
 static int __init init_cramfs_fs(void)
 {
-       cramfs_uncompress_init();
-       return register_filesystem(&cramfs_fs_type);
+       int rv;
+
+       rv = cramfs_uncompress_init();
+       if (rv < 0)
+               return rv;
+       rv = register_filesystem(&cramfs_fs_type);
+       if (rv < 0)
+               cramfs_uncompress_exit();
+       return rv;
 }
 
 static void __exit exit_cramfs_fs(void)