summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-09-22 14:17:15 -0400
committerChanho Park <chanho61.park@samsung.com>2014-11-18 11:52:07 +0900
commitf686291040f05ed23d74cc71910223426888d81b (patch)
tree8b3b2edfceb3b75637d6cd29d32c853082fddf27 /drivers/usb
parentf0ecf5e5d0c47607a01a43e7dd7ffb649e3e5ec4 (diff)
downloadlinux-3.10-f686291040f05ed23d74cc71910223426888d81b.tar.gz
linux-3.10-f686291040f05ed23d74cc71910223426888d81b.tar.bz2
linux-3.10-f686291040f05ed23d74cc71910223426888d81b.zip
upstream: consolidate the reassignments of ->f_op in ->open() instances
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/core/file.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c
index e5387a47ef6..89f90f61247 100644
--- a/drivers/usb/core/file.c
+++ b/drivers/usb/core/file.c
@@ -29,27 +29,19 @@ static DECLARE_RWSEM(minor_rwsem);
static int usb_open(struct inode * inode, struct file * file)
{
- int minor = iminor(inode);
- const struct file_operations *c;
int err = -ENODEV;
- const struct file_operations *old_fops, *new_fops = NULL;
+ const struct file_operations *new_fops;
down_read(&minor_rwsem);
- c = usb_minors[minor];
+ new_fops = fops_get(usb_minors[iminor(inode)]);
- if (!c || !(new_fops = fops_get(c)))
+ if (!new_fops)
goto done;
- old_fops = file->f_op;
- file->f_op = new_fops;
+ replace_fops(file, new_fops);
/* Curiouser and curiouser... NULL ->open() as "no device" ? */
if (file->f_op->open)
err = file->f_op->open(inode,file);
- if (err) {
- fops_put(file->f_op);
- file->f_op = fops_get(old_fops);
- }
- fops_put(old_fops);
done:
up_read(&minor_rwsem);
return err;