]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/configfs/dir.c
[ARM] 4262/1: OMAP: clocksource and clockevent support
[linux-2.6-omap-h63xx.git] / fs / configfs / dir.c
index 1814ba446809ac79ea6ab911a60ac42d1e36d33d..5e6e37e58f36f5369201f0bb0482957beab20fdc 100644 (file)
@@ -72,11 +72,10 @@ static struct configfs_dirent *configfs_new_dirent(struct configfs_dirent * pare
 {
        struct configfs_dirent * sd;
 
-       sd = kmem_cache_alloc(configfs_dir_cachep, GFP_KERNEL);
+       sd = kmem_cache_zalloc(configfs_dir_cachep, GFP_KERNEL);
        if (!sd)
                return NULL;
 
-       memset(sd, 0, sizeof(*sd));
        atomic_set(&sd->s_count, 1);
        INIT_LIST_HEAD(&sd->s_links);
        INIT_LIST_HEAD(&sd->s_children);
@@ -931,7 +930,7 @@ static int configfs_rmdir(struct inode *dir, struct dentry *dentry)
        return 0;
 }
 
-struct inode_operations configfs_dir_inode_operations = {
+const struct inode_operations configfs_dir_inode_operations = {
        .mkdir          = configfs_mkdir,
        .rmdir          = configfs_rmdir,
        .symlink        = configfs_symlink,
@@ -1142,25 +1141,22 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
 
        err = -ENOMEM;
        dentry = d_alloc(configfs_sb->s_root, &name);
-       if (!dentry)
-               goto out_release;
-
-       d_add(dentry, NULL);
+       if (dentry) {
+               d_add(dentry, NULL);
 
-       err = configfs_attach_group(sd->s_element, &group->cg_item,
-                                   dentry);
-       if (!err)
-               dentry = NULL;
-       else
-               d_delete(dentry);
+               err = configfs_attach_group(sd->s_element, &group->cg_item,
+                                           dentry);
+               if (err) {
+                       d_delete(dentry);
+                       dput(dentry);
+               }
+       }
 
        mutex_unlock(&configfs_sb->s_root->d_inode->i_mutex);
 
-       if (dentry) {
-           dput(dentry);
-out_release:
-           unlink_group(group);
-           configfs_release_fs();
+       if (err) {
+               unlink_group(group);
+               configfs_release_fs();
        }
 
        return err;