mtd: nand: switch `check_pattern()' to standard `memcmp()'

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Nov 7 11:59:36 EST 2011


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=75b66d8ccd5772b00a7328c2cf75bc506ec532a1
Commit:     75b66d8ccd5772b00a7328c2cf75bc506ec532a1
Parent:     6d77b9d0af57409c918ab9501866233082546ba6
Author:     Brian Norris <computersforpeace at gmail.com>
AuthorDate: Wed Sep 7 13:13:41 2011 -0700
Committer:  Artem Bityutskiy <artem.bityutskiy at intel.com>
CommitDate: Wed Sep 21 09:19:08 2011 +0300

    mtd: nand: switch `check_pattern()' to standard `memcmp()'
    
    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 at gmail.com>
    Signed-off-by: Artem Bityutskiy <artem.bityutskiy at intel.com>
---
 drivers/mtd/nand/nand_bbt.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index 783093d..5c9c0b2 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -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;



More information about the linux-mtd-cvs mailing list