mtd/drivers/mtd/nand nand_base.c,1.165,1.166

Vitaly Wool vwool at ru.mvista.com
Mon Mar 13 01:09:11 EST 2006


Update of /home/cvs/mtd/drivers/mtd/nand
In directory phoenix.infradead.org:/tmp/cvs-serv9883/drivers/mtd/nand

Modified Files:
	nand_base.c 
Log Message:
[MTD] NAND: fix shifts and bitwise or's

For 16-bit OOB write case, there were right shifts instead of left shifts and logical or's instead of bitwise or's. Fixed.



Index: nand_base.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nand_base.c,v
retrieving revision 1.165
retrieving revision 1.166
diff -u -r1.165 -r1.166
--- nand_base.c	16 Dec 2005 15:41:31 -0000	1.165
+++ nand_base.c	13 Mar 2006 06:09:08 -0000	1.166
@@ -1991,7 +1991,7 @@
 					if (this->options & NAND_BUSWIDTH_16 && i & 1)
 						i--;
 					if (i == 0) {
-						this->write_word(mtd, cpu_to_le16((oob_buf[0] >> 8) || 0xff));
+						this->write_word(mtd, cpu_to_le16((oob_buf[0] << 8) | 0xff));
 						i++;
 						ooblen++;
 					} else
@@ -2002,7 +2002,7 @@
 				i = min_t(int, len + column - ooblen, this->layout[j].length - i);
 				if (i) {
 					if (column) {
-						this->write_word(mtd, cpu_to_le16((oob_buf[0] >> 8) || 0xff));
+						this->write_word(mtd, cpu_to_le16((oob_buf[0] << 8) | 0xff));
 						i--;
 						ooblen++;
 					}
@@ -2012,7 +2012,7 @@
 				}
 				ooblen += i;
 				if (ooblen == len - 1) {
-					this->write_word(mtd, cpu_to_le16(oob_buf[ooblen]) || 0xff00);
+					this->write_word(mtd, cpu_to_le16(oob_buf[ooblen]) | 0xff00);
 					ooblen += 2;
 				}
 				if (ooblen >= len) {





More information about the linux-mtd-cvs mailing list