]> git.baikalelectronics.ru Git - kernel.git/commitdiff
/dev/mem: remove redundant test on len
authorWu Fengguang <fengguang.wu@intel.com>
Tue, 15 Dec 2009 01:57:57 +0000 (17:57 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 15 Dec 2009 16:53:11 +0000 (08:53 -0800)
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>
drivers/char/mem.c

index fba76fb55abfd302bbd87e6433ed858b8b5d2c4d..f0a90590cb1aa63a06afc31a1d6980b3e1dcebfd 100644 (file)
@@ -581,14 +581,12 @@ static ssize_t write_kmem(struct file * file, const char __user * buf,
 
                        if (len > PAGE_SIZE)
                                len = PAGE_SIZE;
-                       if (len) {
-                               written = copy_from_user(kbuf, buf, len);
-                               if (written) {
-                                       if (wrote + virtr)
-                                               break;
-                                       free_page((unsigned long)kbuf);
-                                       return -EFAULT;
-                               }
+                       written = copy_from_user(kbuf, buf, len);
+                       if (written) {
+                               if (wrote + virtr)
+                                       break;
+                               free_page((unsigned long)kbuf);
+                               return -EFAULT;
                        }
                        len = vwrite(kbuf, (char *)p, len);
                        count -= len;