[PATCH 2/2] check if the start address is page-aligned.
Stanley.Miao
stanley.miao at windriver.com
Tue May 18 08:23:10 EDT 2010
Only page-aligned address is permitted in NAND subsystem.
Signed-off-by: Stanley.Miao <stanley.miao at windriver.com>
---
nandwrite.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/nandwrite.c b/nandwrite.c
index 1e30ad1..fbb1153 100644
--- a/nandwrite.c
+++ b/nandwrite.c
@@ -306,6 +306,14 @@ int main(int argc, char * const argv[])
close(fd);
exit (EXIT_FAILURE);
}
+
+ if (mtdoffset & (meminfo.writesize - 1)) {
+ fprintf(stderr, "The start address is not page-aligned !\n"
+ "The pagesize of this NAND Flash is 0x%x.\n",
+ meminfo.writesize);
+ close(fd);
+ exit(EXIT_FAILURE);
+ }
if (autoplace) {
/* Read the current oob info */
--
1.5.4.3
More information about the linux-mtd
mailing list