aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh/adb.c
diff options
context:
space:
mode:
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 dbaad39020a1..40c70ba62bf0 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -644,12 +644,18 @@ do_adb_query(struct adb_request *req)
644static int adb_open(struct inode *inode, struct file *file) 644static int adb_open(struct inode *inode, struct file *file)
645{ 645{
646 struct adbdev_state *state; 646 struct adbdev_state *state;
647 int ret = 0;
647 648
648 if (iminor(inode) > 0 || adb_controller == NULL) 649 lock_kernel();
649 return -ENXIO; 650 if (iminor(inode) > 0 || adb_controller == NULL) {
651 ret = -ENXIO;
652 goto out;
653 }
650 state = kmalloc(sizeof(struct adbdev_state), GFP_KERNEL); 654 state = kmalloc(sizeof(struct adbdev_state), GFP_KERNEL);
651 if (state == 0) 655 if (state == 0) {
652 return -ENOMEM; 656 ret = -ENOMEM;
657 goto out;
658 }
653 file->private_data = state; 659 file->private_data = state;
654 spin_lock_init(&state->lock); 660 spin_lock_init(&state->lock);
655 atomic_set(&state->n_pending, 0); 661 atomic_set(&state->n_pending, 0);
@@ -657,7 +663,9 @@ static int adb_open(struct inode *inode, struct file *file)
657 init_waitqueue_head(&state->wait_queue); 663 init_waitqueue_head(&state->wait_queue);
658 state->inuse = 1; 664 state->inuse = 1;
659 665
660 return 0; 666out:
667 unlock_kernel();
668 return ret;
661} 669}
662 670
663static int adb_release(struct inode *inode, struct file *file) 671static int adb_release(struct inode *inode, struct file *file)