aboutsummaryrefslogtreecommitdiff
path: root/fs/open.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-09-22 16:27:52 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-10-24 23:34:54 -0400
commit72c2d53192004845cbc19cd8a30b3212a9288140 (patch)
tree31fcd924438f03d5aa09d13ffd813fb153da37c3 /fs/open.c
parent22bd002ee76aa7d7a3393f39d977f6c106153c60 (diff)
file->f_op is never NULL...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/open.c b/fs/open.c
index d420331ca32a..a1465b1ec8c7 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -693,6 +693,10 @@ static int do_dentry_open(struct file *f,
}
f->f_op = fops_get(inode->i_fop);
+ if (unlikely(WARN_ON(!f->f_op))) {
+ error = -ENODEV;
+ goto cleanup_all;
+ }
error = security_file_open(f, cred);
if (error)
@@ -702,7 +706,7 @@ static int do_dentry_open(struct file *f,
if (error)
goto cleanup_all;
- if (!open && f->f_op)
+ if (!open)
open = f->f_op->open;
if (open) {
error = open(inode, f);
@@ -1023,7 +1027,7 @@ int filp_close(struct file *filp, fl_owner_t id)
return 0;
}
- if (filp->f_op && filp->f_op->flush)
+ if (filp->f_op->flush)
retval = filp->f_op->flush(filp, id);
if (likely(!(filp->f_mode & FMODE_PATH))) {