diff options
author | Wu Fengguang <fengguang.wu@intel.com> | 2009-12-14 20:57:57 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-15 11:53:11 -0500 |
commit | 4ea2f43f28e30050bc99fe3134b6b679f3bf5b22 (patch) | |
tree | 1b0d50312a85a642b66d971406e9d8b0894250e4 /drivers/char/mem.c | |
parent | 659ace584e7a9fdda872eab4d6d7be1e0afb6cae (diff) |
/dev/mem: remove redundant test on len
The len test in write_kmem() is always true, so can be reduced.
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Acked-by: Andi Kleen <ak@linux.intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Avi Kivity <avi@qumranet.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/mem.c')
-rw-r--r-- | drivers/char/mem.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index fba76fb55abf..f0a90590cb1a 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -581,14 +581,12 @@ static ssize_t write_kmem(struct file * file, const char __user * buf, | |||
581 | 581 | ||
582 | if (len > PAGE_SIZE) | 582 | if (len > PAGE_SIZE) |
583 | len = PAGE_SIZE; | 583 | len = PAGE_SIZE; |
584 | if (len) { | 584 | written = copy_from_user(kbuf, buf, len); |
585 | written = copy_from_user(kbuf, buf, len); | 585 | if (written) { |
586 | if (written) { | 586 | if (wrote + virtr) |
587 | if (wrote + virtr) | 587 | break; |
588 | break; | 588 | free_page((unsigned long)kbuf); |
589 | free_page((unsigned long)kbuf); | 589 | return -EFAULT; |
590 | return -EFAULT; | ||
591 | } | ||
592 | } | 590 | } |
593 | len = vwrite(kbuf, (char *)p, len); | 591 | len = vwrite(kbuf, (char *)p, len); |
594 | count -= len; | 592 | count -= len; |