Commit 4ea2f43f28e30050bc99fe3134b6b679f3bf5b22

Authored by Wu Fengguang
Committed by Linus Torvalds
1 parent 659ace584e

/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>

Showing 1 changed file with 6 additions and 8 deletions Side-by-side Diff

... ... @@ -581,14 +581,12 @@
581 581  
582 582 if (len > PAGE_SIZE)
583 583 len = PAGE_SIZE;
584   - if (len) {
585   - written = copy_from_user(kbuf, buf, len);
586   - if (written) {
587   - if (wrote + virtr)
588   - break;
589   - free_page((unsigned long)kbuf);
590   - return -EFAULT;
591   - }
  584 + written = copy_from_user(kbuf, buf, len);
  585 + if (written) {
  586 + if (wrote + virtr)
  587 + break;
  588 + free_page((unsigned long)kbuf);
  589 + return -EFAULT;
592 590 }
593 591 len = vwrite(kbuf, (char *)p, len);
594 592 count -= len;