[PATCH] [trivial] fixing rightshift in nand_block_bad

Vitaly Wool vwool at ru.mvista.com
Wed Oct 26 07:28:28 EDT 2005


As was discussed in the IRC chat, it's necessary to shift value obtained read_word from right by 8 in case of odd this->badblockpos.
The patch from that is inlined below.

Best regards,
   Vitaly

Index: drivers/mtd/nand/nand_base.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nand_base.c,v
retrieving revision 1.150
diff -u -r1.150 nand_base.c
--- drivers/mtd/nand/nand_base.c	15 Sep 2005 13:58:48 -0000	1.150
+++ drivers/mtd/nand/nand_base.c	26 Oct 2005 11:24:50 -0000
@@ -433,7 +433,7 @@
 		this->cmdfunc (mtd, NAND_CMD_READOOB, this->badblockpos & 0xFE, page & this->pagemask);
 		bad = cpu_to_le16(this->read_word(mtd));
 		if (this->badblockpos & 0x1)
-			bad >>= 1;
+			bad >>= 8;
 		if ((bad & 0xFF) != 0xff)
 			res = 1;
 	} else {




More information about the linux-mtd mailing list