staging: vme_user: remove okcount variable
Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
18f8bee206
commit
32491f561b
1 changed files with 6 additions and 12 deletions
|
@ -182,7 +182,6 @@ static ssize_t vme_user_read(struct file *file, char __user *buf, size_t count,
|
||||||
unsigned int minor = MINOR(file_inode(file)->i_rdev);
|
unsigned int minor = MINOR(file_inode(file)->i_rdev);
|
||||||
ssize_t retval;
|
ssize_t retval;
|
||||||
size_t image_size;
|
size_t image_size;
|
||||||
size_t okcount;
|
|
||||||
|
|
||||||
if (minor == CONTROL_MINOR)
|
if (minor == CONTROL_MINOR)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -200,16 +199,14 @@ static ssize_t vme_user_read(struct file *file, char __user *buf, size_t count,
|
||||||
|
|
||||||
/* Ensure not reading past end of the image */
|
/* Ensure not reading past end of the image */
|
||||||
if (*ppos + count > image_size)
|
if (*ppos + count > image_size)
|
||||||
okcount = image_size - *ppos;
|
count = image_size - *ppos;
|
||||||
else
|
|
||||||
okcount = count;
|
|
||||||
|
|
||||||
switch (type[minor]) {
|
switch (type[minor]) {
|
||||||
case MASTER_MINOR:
|
case MASTER_MINOR:
|
||||||
retval = resource_to_user(minor, buf, okcount, ppos);
|
retval = resource_to_user(minor, buf, count, ppos);
|
||||||
break;
|
break;
|
||||||
case SLAVE_MINOR:
|
case SLAVE_MINOR:
|
||||||
retval = buffer_to_user(minor, buf, okcount, ppos);
|
retval = buffer_to_user(minor, buf, count, ppos);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
retval = -EINVAL;
|
retval = -EINVAL;
|
||||||
|
@ -228,7 +225,6 @@ static ssize_t vme_user_write(struct file *file, const char __user *buf,
|
||||||
unsigned int minor = MINOR(file_inode(file)->i_rdev);
|
unsigned int minor = MINOR(file_inode(file)->i_rdev);
|
||||||
ssize_t retval;
|
ssize_t retval;
|
||||||
size_t image_size;
|
size_t image_size;
|
||||||
size_t okcount;
|
|
||||||
|
|
||||||
if (minor == CONTROL_MINOR)
|
if (minor == CONTROL_MINOR)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -245,16 +241,14 @@ static ssize_t vme_user_write(struct file *file, const char __user *buf,
|
||||||
|
|
||||||
/* Ensure not reading past end of the image */
|
/* Ensure not reading past end of the image */
|
||||||
if (*ppos + count > image_size)
|
if (*ppos + count > image_size)
|
||||||
okcount = image_size - *ppos;
|
count = image_size - *ppos;
|
||||||
else
|
|
||||||
okcount = count;
|
|
||||||
|
|
||||||
switch (type[minor]) {
|
switch (type[minor]) {
|
||||||
case MASTER_MINOR:
|
case MASTER_MINOR:
|
||||||
retval = resource_from_user(minor, buf, okcount, ppos);
|
retval = resource_from_user(minor, buf, count, ppos);
|
||||||
break;
|
break;
|
||||||
case SLAVE_MINOR:
|
case SLAVE_MINOR:
|
||||||
retval = buffer_from_user(minor, buf, okcount, ppos);
|
retval = buffer_from_user(minor, buf, count, ppos);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
retval = -EINVAL;
|
retval = -EINVAL;
|
||||||
|
|
Loading…
Add table
Reference in a new issue