aboutsummaryrefslogtreecommitdiffstats
path: root/fs/char_dev.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/char_dev.c')
-rw-r--r--fs/char_dev.c6
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 */
369static int chrdev_open(struct inode *inode, struct file *filp) 369static 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)