Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 259564
b: refs/heads/master
c: 05614fb
h: refs/heads/master
v: v3
  • Loading branch information
Vincent Bossier authored and Greg Kroah-Hartman committed Jun 28, 2011
1 parent 83f92cd commit c3cef6f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 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: 56fc508186dbec9aca46cd034ef12358fc044ac1
refs/heads/master: 05614fbfc1f3dedc337ac67e83b6ad130ba9fc9f
13 changes: 11 additions & 2 deletions trunk/drivers/staging/vme/devices/vme_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ static int vme_user_open(struct inode *inode, struct file *file)
unsigned int minor = MINOR(inode->i_rdev);

down(&image[minor].sem);
/* Only allow device to be opened if a resource is allocated */
if (image[minor].resource == NULL) {
/* Allow device to be opened if a resource is needed and allocated. */
if (minor < CONTROL_MINOR && image[minor].resource == NULL) {
printk(KERN_ERR "No resources allocated for device\n");
err = -EINVAL;
goto err_res;
Expand Down Expand Up @@ -321,6 +321,9 @@ static ssize_t vme_user_read(struct file *file, char __user *buf, size_t count,
size_t image_size;
size_t okcount;

if (minor == CONTROL_MINOR)
return 0;

down(&image[minor].sem);

/* XXX Do we *really* want this helper - we can use vme_*_get ? */
Expand Down Expand Up @@ -365,6 +368,9 @@ static ssize_t vme_user_write(struct file *file, const char __user *buf,
size_t image_size;
size_t okcount;

if (minor == CONTROL_MINOR)
return 0;

down(&image[minor].sem);

image_size = vme_get_size(image[minor].resource);
Expand Down Expand Up @@ -406,6 +412,9 @@ static loff_t vme_user_llseek(struct file *file, loff_t off, int whence)
unsigned int minor = MINOR(file->f_dentry->d_inode->i_rdev);
size_t image_size;

if (minor == CONTROL_MINOR)
return -EINVAL;

down(&image[minor].sem);
image_size = vme_get_size(image[minor].resource);

Expand Down

0 comments on commit c3cef6f

Please sign in to comment.