linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "Stanley.Miao" <stanley.miao@windriver.com>
To: linux-mtd@lists.infradead.org
Subject: [PATCH 2/5] check if the start address is page-aligned.
Date: Wed,  3 Feb 2010 10:56:33 +0800	[thread overview]
Message-ID: <1265165796-24686-3-git-send-email-stanley.miao@windriver.com> (raw)
In-Reply-To: <1265165796-24686-2-git-send-email-stanley.miao@windriver.com>

Only page-aligned address is permitted in NAND subsystem.

Signed-off-by: Stanley.Miao <stanley.miao@windriver.com>
---
 nandwrite.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/nandwrite.c b/nandwrite.c
index c66eda0..c66ab54 100644
--- a/nandwrite.c
+++ b/nandwrite.c
@@ -248,6 +248,13 @@ int main(int argc, char * const argv[])
 		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);
+	}
 
 	oob.length = meminfo.oobsize;
 	oob.ptr =  oobbuf;
-- 
1.5.4.3

  reply	other threads:[~2010-02-03  2:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-03  2:56 Stanley.Miao
2010-02-03  2:56 ` [PATCH 1/5] clean up the legacy interfaces in nandwrite.c Stanley.Miao
2010-02-03  2:56   ` Stanley.Miao [this message]
2010-02-03  2:56     ` [PATCH 3/5] Fix the bug of writing a yaffs2 image to NAND Stanley.Miao
2010-02-03  2:56       ` [PATCH 4/5] Discard the legacy interface MEMGETOOBSEL in flash_eraseall Stanley.Miao
2010-02-03  2:56         ` [PATCH 5/5] Place the cleanmarker in OOB area according to the mode MTD_OOB_AUTO Stanley.Miao
2010-02-03  3:16 ` Mike Frysinger
2010-02-03  4:31   ` Re: stanley.miao
  -- strict thread matches above, loose matches on Subject: below --
2010-02-03  4:45 Fix mtd-utils bugs Stanley.Miao
2010-02-03  4:45 ` [PATCH 1/5] clean up the legacy interfaces in nandwrite.c Stanley.Miao
2010-02-03  4:45   ` [PATCH 2/5] check if the start address is page-aligned Stanley.Miao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1265165796-24686-3-git-send-email-stanley.miao@windriver.com \
    --to=stanley.miao@windriver.com \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).