Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 100270
b: refs/heads/master
c: 0bec0bb
h: refs/heads/master
v: v3
  • Loading branch information
Jonathan Corbet committed May 18, 2008
1 parent d55634a commit 5e56bb9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 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: 0911810755fc9f15659cc3cb43912633b90027a0
refs/heads/master: 0bec0bba7a507bdaf07312fcabdc00b5576abb32
25 changes: 18 additions & 7 deletions trunk/drivers/pcmcia/pcmcia_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <linux/proc_fs.h>
#include <linux/poll.h>
#include <linux/pci.h>
#include <linux/smp_lock.h>
#include <linux/workqueue.h>

#define IN_CARD_SERVICES
Expand Down Expand Up @@ -397,20 +398,27 @@ static int ds_open(struct inode *inode, struct file *file)
struct pcmcia_socket *s;
user_info_t *user;
static int warning_printed = 0;
int ret = 0;

ds_dbg(0, "ds_open(socket %d)\n", i);

lock_kernel();
s = pcmcia_get_socket_by_nr(i);
if (!s)
return -ENODEV;
if (!s) {
ret = -ENODEV;
goto out;
}
s = pcmcia_get_socket(s);
if (!s)
return -ENODEV;
if (!s) {
ret = -ENODEV;
goto out;
}

if ((file->f_flags & O_ACCMODE) != O_RDONLY) {
if (s->pcmcia_state.busy) {
pcmcia_put_socket(s);
return -EBUSY;
ret = -EBUSY;
goto out;
}
else
s->pcmcia_state.busy = 1;
Expand All @@ -419,7 +427,8 @@ static int ds_open(struct inode *inode, struct file *file)
user = kmalloc(sizeof(user_info_t), GFP_KERNEL);
if (!user) {
pcmcia_put_socket(s);
return -ENOMEM;
ret = -ENOMEM;
goto out;
}
user->event_tail = user->event_head = 0;
user->next = s->user;
Expand All @@ -441,7 +450,9 @@ static int ds_open(struct inode *inode, struct file *file)

if (s->pcmcia_state.present)
queue_event(user, CS_EVENT_CARD_INSERTION);
return 0;
out:
unlock_kernel();
return ret;
} /* ds_open */

/*====================================================================*/
Expand Down

0 comments on commit 5e56bb9

Please sign in to comment.