yaffsfs.c: Fix NULL dereference in yaffs_unmount2_reldev()
[yaffs2.git] / direct / u-boot / fs / yaffs2 / yaffs_mtdif.c
index db49052b385ea0d9c46de954fc3d648869f3f526..c12c70a698bbad6bf15b9c79abdaf40bfea452a1 100644 (file)
@@ -1,8 +1,7 @@
 /*
  * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
  *
- * Copyright (C) 2002-2007 Aleph One Ltd.
- *   for Toby Churchill Ltd and Brightstar Engineering
+ * Copyright (C) 2002-2018 Aleph One Ltd.
  *
  * Created by Charles Manning <charles@aleph1.co.uk>
  *
@@ -66,7 +65,7 @@ int nandmtd_WriteChunkToNAND(struct yaffs_dev *dev, int chunkInNAND,
        struct mtd_oob_ops ops;
        size_t dummy;
        int retval = 0;
-       loff_t addr = ((loff_t) chunkInNAND) * dev->data_bytes_per_chunk;
+       loff_t addr = ((loff_t) chunkInNAND) * dev->param.total_bytes_per_chunk;
        u8 spareAsBytes[8]; /* OOB */
 
        if (data && !spare)
@@ -102,7 +101,7 @@ int nandmtd_ReadChunkFromNAND(struct yaffs_dev *dev, int chunkInNAND, u8 *data,
        size_t dummy;
        int retval = 0;
 
-       loff_t addr = ((loff_t) chunkInNAND) * dev->data_bytes_per_chunk;
+       loff_t addr = ((loff_t) chunkInNAND) * dev->param.total_bytes_per_chunk;
        u8 spareAsBytes[8]; /* OOB */
 
        if (data && !spare)
@@ -135,7 +134,7 @@ int nandmtd_EraseBlockInNAND(struct yaffs_dev *dev, int blockNumber)
 {
        struct mtd_info *mtd = (struct mtd_info *)(dev->driver_context);
        __u32 addr =
-           ((loff_t) blockNumber) * dev->data_bytes_per_chunk
+           ((loff_t) blockNumber) * dev->param.total_bytes_per_chunk
                * dev->param.chunks_per_block;
        struct erase_info ei;
        int retval = 0;