aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh/adb.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2008-07-15 01:44:51 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2008-07-15 01:44:51 -0400
commit43d2548bb2ef7e6d753f91468a746784041e522d (patch)
tree77d13fcd48fd998393abb825ec36e2b732684a73 /drivers/macintosh/adb.c
parent585583d95c5660973bc0cf64add517b040acd8a4 (diff)
parent85082fd7cbe3173198aac0eb5e85ab1edcc6352c (diff)
Merge commit '85082fd7cbe3173198aac0eb5e85ab1edcc6352c' into test-build
Manual fixup of: arch/powerpc/Kconfig
Diffstat (limited to 'drivers/macintosh/adb.c')
-rw-r--r--drivers/macintosh/adb.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index 61b62a6f681b..e5d446804d32 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -643,12 +643,18 @@ do_adb_query(struct adb_request *req)
643static int adb_open(struct inode *inode, struct file *file) 643static int adb_open(struct inode *inode, struct file *file)
644{ 644{
645 struct adbdev_state *state; 645 struct adbdev_state *state;
646 int ret = 0;
646 647
647 if (iminor(inode) > 0 || adb_controller == NULL) 648 lock_kernel();
648 return -ENXIO; 649 if (iminor(inode) > 0 || adb_controller == NULL) {
650 ret = -ENXIO;
651 goto out;
652 }
649 state = kmalloc(sizeof(struct adbdev_state), GFP_KERNEL); 653 state = kmalloc(sizeof(struct adbdev_state), GFP_KERNEL);
650 if (state == 0) 654 if (state == 0) {
651 return -ENOMEM; 655 ret = -ENOMEM;
656 goto out;
657 }
652 file->private_data = state; 658 file->private_data = state;
653 spin_lock_init(&state->lock); 659 spin_lock_init(&state->lock);
654 atomic_set(&state->n_pending, 0); 660 atomic_set(&state->n_pending, 0);
@@ -656,7 +662,9 @@ static int adb_open(struct inode *inode, struct file *file)
656 init_waitqueue_head(&state->wait_queue); 662 init_waitqueue_head(&state->wait_queue);
657 state->inuse = 1; 663 state->inuse = 1;
658 664
659 return 0; 665out:
666 unlock_kernel();
667 return ret;
660} 668}
661 669
662static int adb_release(struct inode *inode, struct file *file) 670static int adb_release(struct inode *inode, struct file *file)