]> err.no Git - linux-2.6/commitdiff
adb: BKL pushdown
authorJonathan Corbet <corbet@lwn.net>
Fri, 16 May 2008 20:19:56 +0000 (14:19 -0600)
committerJonathan Corbet <corbet@lwn.net>
Fri, 20 Jun 2008 20:05:52 +0000 (14:05 -0600)
Put explicit lock_kernel() calls in adb_open().  The fact that
adb_release() already has them suggests this is necessary.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
drivers/macintosh/adb.c

index dbaad39020a1bc75b5ef48bc3c837d9c45431c2b..40c70ba62bf0eff36362cf7cb5c4129afb2436d0 100644 (file)
@@ -644,12 +644,18 @@ do_adb_query(struct adb_request *req)
 static int adb_open(struct inode *inode, struct file *file)
 {
        struct adbdev_state *state;
+       int ret = 0;
 
-       if (iminor(inode) > 0 || adb_controller == NULL)
-               return -ENXIO;
+       lock_kernel();
+       if (iminor(inode) > 0 || adb_controller == NULL) {
+               ret = -ENXIO;
+               goto out;
+       }
        state = kmalloc(sizeof(struct adbdev_state), GFP_KERNEL);
-       if (state == 0)
-               return -ENOMEM;
+       if (state == 0) {
+               ret = -ENOMEM;
+               goto out;
+       }
        file->private_data = state;
        spin_lock_init(&state->lock);
        atomic_set(&state->n_pending, 0);
@@ -657,7 +663,9 @@ static int adb_open(struct inode *inode, struct file *file)
        init_waitqueue_head(&state->wait_queue);
        state->inuse = 1;
 
-       return 0;
+out:
+       unlock_kernel();
+       return ret;
 }
 
 static int adb_release(struct inode *inode, struct file *file)