diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-09-22 14:17:15 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-10-24 23:34:53 -0400 |
commit | e84f9e57b90ca89664d733a7cef19aa7ccd832f3 (patch) | |
tree | 2766cbae82e38a4356b161a7f48abfd9e4db56ce /fs/char_dev.c | |
parent | 7b00ed6fe6321547b9d51f5bfb30e7b5932e6889 (diff) |
consolidate the reassignments of ->f_op in ->open() instances
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/char_dev.c')
-rw-r--r-- | fs/char_dev.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/char_dev.c b/fs/char_dev.c index afc2bb691780..94b5f60076da 100644 --- a/fs/char_dev.c +++ b/fs/char_dev.c | |||
@@ -368,6 +368,7 @@ void cdev_put(struct cdev *p) | |||
368 | */ | 368 | */ |
369 | static int chrdev_open(struct inode *inode, struct file *filp) | 369 | static int chrdev_open(struct inode *inode, struct file *filp) |
370 | { | 370 | { |
371 | const struct file_operations *fops; | ||
371 | struct cdev *p; | 372 | struct cdev *p; |
372 | struct cdev *new = NULL; | 373 | struct cdev *new = NULL; |
373 | int ret = 0; | 374 | int ret = 0; |
@@ -400,10 +401,11 @@ static int chrdev_open(struct inode *inode, struct file *filp) | |||
400 | return ret; | 401 | return ret; |
401 | 402 | ||
402 | ret = -ENXIO; | 403 | ret = -ENXIO; |
403 | filp->f_op = fops_get(p->ops); | 404 | fops = fops_get(p->ops); |
404 | if (!filp->f_op) | 405 | if (!fops) |
405 | goto out_cdev_put; | 406 | goto out_cdev_put; |
406 | 407 | ||
408 | replace_fops(filp, fops); | ||
407 | if (filp->f_op->open) { | 409 | if (filp->f_op->open) { |
408 | ret = filp->f_op->open(inode, filp); | 410 | ret = filp->f_op->open(inode, filp); |
409 | if (ret) | 411 | if (ret) |