Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 100316
b: refs/heads/master
c: 26ce4f0
h: refs/heads/master
v: v3
  • Loading branch information
Jonathan Corbet committed Jun 20, 2008
1 parent d8a3059 commit 456f4f5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 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: 3462032d66703ef7721329b44fe2dac4aaef475d
refs/heads/master: 26ce4f0684ef4b96d0244ac58b89ec282d5b980c
18 changes: 13 additions & 5 deletions trunk/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 456f4f5

Please sign in to comment.