Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 100365
b: refs/heads/master
c: f9c8154
h: refs/heads/master
i:
  100363: b5baf96
v: v3
  • Loading branch information
Arnd Bergmann authored and Jonathan Corbet committed Jul 2, 2008
1 parent d00629e commit d95164a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 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: dca67e9d3db27b090259b696e1166615f40099e2
refs/heads/master: f9c8154f367d471f1af56742fe8534f8458adb98
12 changes: 10 additions & 2 deletions trunk/drivers/input/mousedev.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#define MOUSEDEV_MIX 31

#include <linux/slab.h>
#include <linux/smp_lock.h>
#include <linux/poll.h>
#include <linux/module.h>
#include <linux/init.h>
Expand Down Expand Up @@ -545,16 +546,21 @@ static int mousedev_open(struct inode *inode, struct file *file)
if (i >= MOUSEDEV_MINORS)
return -ENODEV;

lock_kernel();
error = mutex_lock_interruptible(&mousedev_table_mutex);
if (error)
if (error) {
unlock_kernel();
return error;
}
mousedev = mousedev_table[i];
if (mousedev)
get_device(&mousedev->dev);
mutex_unlock(&mousedev_table_mutex);

if (!mousedev)
if (!mousedev) {
unlock_kernel();
return -ENODEV;
}

client = kzalloc(sizeof(struct mousedev_client), GFP_KERNEL);
if (!client) {
Expand All @@ -573,13 +579,15 @@ static int mousedev_open(struct inode *inode, struct file *file)
goto err_free_client;

file->private_data = client;
unlock_kernel();
return 0;

err_free_client:
mousedev_detach_client(mousedev, client);
kfree(client);
err_put_mousedev:
put_device(&mousedev->dev);
unlock_kernel();
return error;
}

Expand Down

0 comments on commit d95164a

Please sign in to comment.