Commit f6ef7b7b authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Al Viro

proc: remove a level of indentation in proc_get_inode

Just return early on inode allocation failure.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 9123e3a7
...@@ -619,42 +619,44 @@ struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de) ...@@ -619,42 +619,44 @@ struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de)
{ {
struct inode *inode = new_inode(sb); struct inode *inode = new_inode(sb);
if (inode) { if (!inode) {
inode->i_ino = de->low_ino; pde_put(de);
inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); return NULL;
PROC_I(inode)->pde = de; }
if (is_empty_pde(de)) { inode->i_ino = de->low_ino;
make_empty_dir_inode(inode); inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
return inode; PROC_I(inode)->pde = de;
} if (is_empty_pde(de)) {
if (de->mode) { make_empty_dir_inode(inode);
inode->i_mode = de->mode; return inode;
inode->i_uid = de->uid; }
inode->i_gid = de->gid;
} if (de->mode) {
if (de->size) inode->i_mode = de->mode;
inode->i_size = de->size; inode->i_uid = de->uid;
if (de->nlink) inode->i_gid = de->gid;
set_nlink(inode, de->nlink); }
if (de->size)
if (S_ISREG(inode->i_mode)) { inode->i_size = de->size;
inode->i_op = de->proc_iops; if (de->nlink)
inode->i_fop = &proc_reg_file_ops; set_nlink(inode, de->nlink);
if (S_ISREG(inode->i_mode)) {
inode->i_op = de->proc_iops;
inode->i_fop = &proc_reg_file_ops;
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
if (!de->proc_ops->proc_compat_ioctl) { if (!de->proc_ops->proc_compat_ioctl)
inode->i_fop = &proc_reg_file_ops_no_compat; inode->i_fop = &proc_reg_file_ops_no_compat;
}
#endif #endif
} else if (S_ISDIR(inode->i_mode)) { } else if (S_ISDIR(inode->i_mode)) {
inode->i_op = de->proc_iops; inode->i_op = de->proc_iops;
inode->i_fop = de->proc_dir_ops; inode->i_fop = de->proc_dir_ops;
} else if (S_ISLNK(inode->i_mode)) { } else if (S_ISLNK(inode->i_mode)) {
inode->i_op = de->proc_iops; inode->i_op = de->proc_iops;
inode->i_fop = NULL; inode->i_fop = NULL;
} else } else {
BUG(); BUG();
} else }
pde_put(de);
return inode; return inode;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment