]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mtd: mtdchar: add missing initializer on raw write
authorPeter Wippich <pewi@gw-instruments.de>
Mon, 6 Jun 2011 13:50:58 +0000 (15:50 +0200)
committerArtem Bityutskiy <dedekind1@gmail.com>
Thu, 23 Jun 2011 08:43:41 +0000 (11:43 +0300)
On writes in MODE_RAW the mtd_oob_ops struct is not sufficiently
initialized which may cause nandwrite to fail. With this patch
it is possible to write raw nand/oob data without additional ECC
(either for testing or when some sectors need different oob layout
e.g. bootloader) like
nandwrite  -n -r -o  /dev/mtd0 <myfile>

Signed-off-by: Peter Wippich <pewi@gw-instruments.de>
Cc: stable@kernel.org
Tested-by: Ricard Wanderlof <ricardw@axis.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
drivers/mtd/mtdchar.c

index 3f92731a5b9ebf288ed83602c36972e5d32dee8d..9f8658ef946711469ef3625933ed6fd7c60959ef 100644 (file)
@@ -320,6 +320,7 @@ static ssize_t mtd_write(struct file *file, const char __user *buf, size_t count
                        ops.mode = MTD_OOB_RAW;
                        ops.datbuf = kbuf;
                        ops.oobbuf = NULL;
+                       ops.ooboffs = 0;
                        ops.len = len;
 
                        ret = mtd->write_oob(mtd, *ppos, &ops);