diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-09-22 20:17:15 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-10-25 05:34:53 +0200 |
commit | e84f9e57b90ca89664d733a7cef19aa7ccd832f3 (patch) | |
tree | 2766cbae82e38a4356b161a7f48abfd9e4db56ce /drivers/char/misc.c | |
parent | put_mnt_ns(): use drop_collected_mounts() (diff) | |
download | linux-e84f9e57b90ca89664d733a7cef19aa7ccd832f3.tar.xz linux-e84f9e57b90ca89664d733a7cef19aa7ccd832f3.zip |
consolidate the reassignments of ->f_op in ->open() instances
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/char/misc.c')
-rw-r--r-- | drivers/char/misc.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/char/misc.c b/drivers/char/misc.c index 190d4423653f..fd0f7c4b4df9 100644 --- a/drivers/char/misc.c +++ b/drivers/char/misc.c @@ -114,7 +114,7 @@ static int misc_open(struct inode * inode, struct file * file) int minor = iminor(inode); struct miscdevice *c; int err = -ENODEV; - const struct file_operations *old_fops, *new_fops = NULL; + const struct file_operations *new_fops = NULL; mutex_lock(&misc_mtx); @@ -141,17 +141,11 @@ static int misc_open(struct inode * inode, struct file * file) } err = 0; - old_fops = file->f_op; - file->f_op = new_fops; + replace_fops(file, new_fops); if (file->f_op->open) { file->private_data = c; - err=file->f_op->open(inode,file); - if (err) { - fops_put(file->f_op); - file->f_op = fops_get(old_fops); - } + err = file->f_op->open(inode,file); } - fops_put(old_fops); fail: mutex_unlock(&misc_mtx); return err; |