Skip to content

Commit

Permalink
adb: BKL pushdown
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jonathan Corbet committed Jun 20, 2008
1 parent 3462032 commit 26ce4f0
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions drivers/macintosh/adb.c
Original file line number Diff line number Diff line change
Expand Up @@ -644,20 +644,28 @@ 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);
state->completed = NULL;
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)
Expand Down

0 comments on commit 26ce4f0

Please sign in to comment.