Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 100278
b: refs/heads/master
c: 2edbf85
h: refs/heads/master
v: v3
  • Loading branch information
Jonathan Corbet committed Jun 20, 2008
1 parent 726fd86 commit aef3ee7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 702e57d9ef7002f8d362faa6ddebc59e6d43fa05
refs/heads/master: 2edbf8537edc62c9b0ef75e7025d01e8b6a48707
16 changes: 12 additions & 4 deletions trunk/drivers/input/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <linux/device.h>
#include <linux/mutex.h>
#include <linux/rcupdate.h>
#include <linux/smp_lock.h>

MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
MODULE_DESCRIPTION("Input core");
Expand Down Expand Up @@ -1588,21 +1589,26 @@ EXPORT_SYMBOL(input_unregister_handle);

static int input_open_file(struct inode *inode, struct file *file)
{
struct input_handler *handler = input_table[iminor(inode) >> 5];
struct input_handler *handler;
const struct file_operations *old_fops, *new_fops = NULL;
int err;

lock_kernel();
/* No load-on-demand here? */
if (!handler || !(new_fops = fops_get(handler->fops)))
return -ENODEV;
handler = input_table[iminor(inode) >> 5];
if (!handler || !(new_fops = fops_get(handler->fops))) {
err = -ENODEV;
goto out;
}

/*
* That's _really_ odd. Usually NULL ->open means "nothing special",
* not "no device". Oh, well...
*/
if (!new_fops->open) {
fops_put(new_fops);
return -ENODEV;
err = -ENODEV;
goto out;
}
old_fops = file->f_op;
file->f_op = new_fops;
Expand All @@ -1614,6 +1620,8 @@ static int input_open_file(struct inode *inode, struct file *file)
file->f_op = fops_get(old_fops);
}
fops_put(old_fops);
out:
unlock_kernel();
return err;
}

Expand Down

0 comments on commit aef3ee7

Please sign in to comment.