mtd: nand: switch `check_pattern()' to standard `memcmp()'
authorBrian Norris <computersforpeace@gmail.com>
Wed, 7 Sep 2011 20:13:41 +0000 (13:13 -0700)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Wed, 21 Sep 2011 06:19:08 +0000 (09:19 +0300)
A portion of the `check_pattern()' function is basically a `memcmp()'.
Since it's possible for `memcmp()' to be optimized for a particular
architecture, we should use it instead.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
drivers/mtd/nand/nand_bbt.c

index 783093d1a2e512d0a0225594362ffa472b50e336..5c9c0b2f09d4ad81b762059eb4795197fafc711e 100644 (file)
@@ -107,10 +107,8 @@ static int check_pattern(uint8_t *buf, int len, int paglen, struct nand_bbt_desc
        p += end;
 
        /* Compare the pattern */
-       for (i = 0; i < td->len; i++) {
-               if (p[i] != td->pattern[i])
-                       return -1;
-       }
+       if (memcmp(p, td->pattern, td->len))
+               return -1;
 
        if (td->options & NAND_BBT_SCANEMPTY) {
                p += td->len;