From: Charles Manning Date: Mon, 24 Jun 2013 05:13:30 +0000 (+1200) Subject: Clean up parameters being passed to mtd X-Git-Tag: aleph1-release~52 X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=commitdiff_plain;h=3a6178aac1813ac8ef1ce63b232644385c1ab89b;hp=1dd2d1919e78641592098968e221b661a7451a58 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 --- 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;