aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/generic.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc/generic.c')
-rw-r--r--fs/proc/generic.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 7dfe548a28e8..2983dc52ca25 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -412,8 +412,7 @@ static const struct dentry_operations proc_dentry_operations =
412struct dentry *proc_lookup_de(struct proc_dir_entry *de, struct inode *dir, 412struct dentry *proc_lookup_de(struct proc_dir_entry *de, struct inode *dir,
413 struct dentry *dentry) 413 struct dentry *dentry)
414{ 414{
415 struct inode *inode = NULL; 415 struct inode *inode;
416 int error = -ENOENT;
417 416
418 spin_lock(&proc_subdir_lock); 417 spin_lock(&proc_subdir_lock);
419 for (de = de->subdir; de ; de = de->next) { 418 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,
422 if (!memcmp(dentry->d_name.name, de->name, de->namelen)) { 421 if (!memcmp(dentry->d_name.name, de->name, de->namelen)) {
423 pde_get(de); 422 pde_get(de);
424 spin_unlock(&proc_subdir_lock); 423 spin_unlock(&proc_subdir_lock);
425 error = -ENOMEM;
426 inode = proc_get_inode(dir->i_sb, de); 424 inode = proc_get_inode(dir->i_sb, de);
427 goto out_unlock; 425 if (!inode)
426 return ERR_PTR(-ENOMEM);
427 d_set_d_op(dentry, &proc_dentry_operations);
428 d_add(dentry, inode);
429 return NULL;
428 } 430 }
429 } 431 }
430 spin_unlock(&proc_subdir_lock); 432 spin_unlock(&proc_subdir_lock);
431out_unlock: 433 return ERR_PTR(-ENOENT);
432
433 if (inode) {
434 d_set_d_op(dentry, &proc_dentry_operations);
435 d_add(dentry, inode);
436 return NULL;
437 }
438 if (de)
439 pde_put(de);
440 return ERR_PTR(error);
441} 434}
442 435
443struct dentry *proc_lookup(struct inode *dir, struct dentry *dentry, 436struct dentry *proc_lookup(struct inode *dir, struct dentry *dentry,