diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-01-25 20:11:22 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-02-26 02:46:14 -0500 |
commit | d3d009cb965eae7e002ea5badf603ea8f4c34915 (patch) | |
tree | 624a97e06717507d4246da2369b684d4ebd6e0a9 /fs/proc/generic.c | |
parent | 87e0aab37ff6c4284810a48d6034314fbf4eb319 (diff) | |
download | kernel_goldelico_gta04-d3d009cb965eae7e002ea5badf603ea8f4c34915.zip kernel_goldelico_gta04-d3d009cb965eae7e002ea5badf603ea8f4c34915.tar.gz kernel_goldelico_gta04-d3d009cb965eae7e002ea5badf603ea8f4c34915.tar.bz2 |
saner proc_get_inode() calling conventions
Make it drop the pde in *all* cases when no new reference to it is
put into an inode - both when an inode had already been set up
(as we were already doing) and when inode allocation has failed.
Makes for simpler logics in callers...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/proc/generic.c')
-rw-r--r-- | fs/proc/generic.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 7dfe548..2983dc5 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c @@ -412,8 +412,7 @@ static const struct dentry_operations proc_dentry_operations = struct dentry *proc_lookup_de(struct proc_dir_entry *de, struct inode *dir, struct dentry *dentry) { - struct inode *inode = NULL; - int error = -ENOENT; + struct inode *inode; spin_lock(&proc_subdir_lock); for (de = de->subdir; de ; de = de->next) { @@ -422,22 +421,16 @@ struct dentry *proc_lookup_de(struct proc_dir_entry *de, struct inode *dir, if (!memcmp(dentry->d_name.name, de->name, de->namelen)) { pde_get(de); spin_unlock(&proc_subdir_lock); - error = -ENOMEM; inode = proc_get_inode(dir->i_sb, de); - goto out_unlock; + if (!inode) + return ERR_PTR(-ENOMEM); + d_set_d_op(dentry, &proc_dentry_operations); + d_add(dentry, inode); + return NULL; } } spin_unlock(&proc_subdir_lock); -out_unlock: - - if (inode) { - d_set_d_op(dentry, &proc_dentry_operations); - d_add(dentry, inode); - return NULL; - } - if (de) - pde_put(de); - return ERR_PTR(error); + return ERR_PTR(-ENOENT); } struct dentry *proc_lookup(struct inode *dir, struct dentry *dentry, |