yaffsfs.c: Fix NULL dereference in yaffs_unmount2_reldev()
[yaffs2.git] / direct / test-framework / nanddrv.c
index 5fb05c0a2f46f619c22998a43a8dbd99a419d0b6..07c4fecd251e14aa2c70f37ad1807980d6e249f7 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
  *
- * Copyright (C) 2010-2011 Aleph One Ltd.
+ * Copyright (C) 2002-2018 Aleph One Ltd.
  *
  * Created by Charles Manning <charles@aleph1.co.uk>
  *
@@ -75,7 +75,6 @@ int nanddrv_read_tr(struct nand_chip *this, int page,
 {
        unsigned char status;
        int ncycles;
-       unsigned char *buffer;
 
        if(n_tr < 1)
                return 0;
@@ -98,7 +97,7 @@ int nanddrv_read_tr(struct nand_chip *this, int page,
                                buffer++;
                        }
                } else {
-                       unsigned short *buffer = tr->buffer;
+                       unsigned short *buffer = (unsigned short *)tr->buffer;
 
                        ncycles = tr->nbytes >> 1;
                        while (ncycles> 0) {
@@ -145,7 +144,7 @@ int nanddrv_write_tr(struct nand_chip *this, int page,
                                buffer++;
                        }
                } else {
-                       unsigned short *buffer = tr->buffer;
+                       unsigned short *buffer = (unsigned short *)tr->buffer;
 
                        ncycles = tr->nbytes >> 1;
                        while (ncycles> 0) {