From 3a6178aac1813ac8ef1ce63b232644385c1ab89b Mon Sep 17 00:00:00 2001 From: Charles Manning Date: Mon, 24 Jun 2013 17:13:30 +1200 Subject: [PATCH 1/1] Clean up parameters being passed to mtd Some nand implementations are fussy about the parameters being passed in. If the ptr or length of data or oob is zero, then clear out the whole parameter pair. Signed-off-by: Charles Manning --- yaffs_mtdif_multi.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/yaffs_mtdif_multi.c b/yaffs_mtdif_multi.c index 265dd78..fe91a9e 100644 --- a/yaffs_mtdif_multi.c +++ b/yaffs_mtdif_multi.c @@ -78,6 +78,20 @@ static int yaffs_mtd_write(struct yaffs_dev *dev, int nand_chunk, struct mtd_oob_ops ops; int retval; + yaffs_trace(YAFFS_TRACE_MTD, + "yaffs_mtd_write(%p, %d, %p, %d, %p, %d)\n", + dev, nand_chunk, data, data_len, oob, oob_len); + + if (!data || !data_len) { + data = NULL; + data_len = 0; + } + + if (!oob || !oob_len) { + oob = NULL; + oob_len = 0; + } + addr = ((loff_t) nand_chunk) * dev->param.total_bytes_per_chunk; memset(&ops, 0, sizeof(ops)); ops.mode = MTD_OPS_AUTO_OOB; -- 2.30.2