aboutsummaryrefslogtreecommitdiffstats
path: root/fs/anon_inodes.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/anon_inodes.c')
-rw-r--r--fs/anon_inodes.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c
index 28d39fb84ae3..47a65df8c871 100644
--- a/fs/anon_inodes.c
+++ b/fs/anon_inodes.c
@@ -131,7 +131,6 @@ struct file *anon_inode_getfile(const char *name,
131 struct qstr this; 131 struct qstr this;
132 struct path path; 132 struct path path;
133 struct file *file; 133 struct file *file;
134 int error;
135 134
136 if (IS_ERR(anon_inode_inode)) 135 if (IS_ERR(anon_inode_inode))
137 return ERR_PTR(-ENODEV); 136 return ERR_PTR(-ENODEV);
@@ -143,7 +142,7 @@ struct file *anon_inode_getfile(const char *name,
143 * Link the inode to a directory entry by creating a unique name 142 * Link the inode to a directory entry by creating a unique name
144 * using the inode sequence number. 143 * using the inode sequence number.
145 */ 144 */
146 error = -ENOMEM; 145 file = ERR_PTR(-ENOMEM);
147 this.name = name; 146 this.name = name;
148 this.len = strlen(name); 147 this.len = strlen(name);
149 this.hash = 0; 148 this.hash = 0;
@@ -160,15 +159,12 @@ struct file *anon_inode_getfile(const char *name,
160 159
161 d_instantiate(path.dentry, anon_inode_inode); 160 d_instantiate(path.dentry, anon_inode_inode);
162 161
163 error = -ENFILE;
164 file = alloc_file(&path, OPEN_FMODE(flags), fops); 162 file = alloc_file(&path, OPEN_FMODE(flags), fops);
165 if (!file) 163 if (IS_ERR(file))
166 goto err_dput; 164 goto err_dput;
167 file->f_mapping = anon_inode_inode->i_mapping; 165 file->f_mapping = anon_inode_inode->i_mapping;
168 166
169 file->f_pos = 0;
170 file->f_flags = flags & (O_ACCMODE | O_NONBLOCK); 167 file->f_flags = flags & (O_ACCMODE | O_NONBLOCK);
171 file->f_version = 0;
172 file->private_data = priv; 168 file->private_data = priv;
173 169
174 return file; 170 return file;
@@ -177,7 +173,7 @@ err_dput:
177 path_put(&path); 173 path_put(&path);
178err_module: 174err_module:
179 module_put(fops->owner); 175 module_put(fops->owner);
180 return ERR_PTR(error); 176 return file;
181} 177}
182EXPORT_SYMBOL_GPL(anon_inode_getfile); 178EXPORT_SYMBOL_GPL(anon_inode_getfile);
183 179