[MTD] Only call mtd->sync() method in mtdchar close if opened for write.

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Thu Jun 28 14:59:01 EDT 2007


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=7eafaed55f4b8599cfe55449a6ed88d3693954de
Commit:     7eafaed55f4b8599cfe55449a6ed88d3693954de
Parent:     fd5324909e410a3202c1b01bd507c2dfba58fca5
Author:     Joakim Tjernlund <Joakim.Tjernlund at transmode.se>
AuthorDate: Wed Jun 27 00:56:40 2007 +0200
Committer:  David Woodhouse <dwmw2 at infradead.org>
CommitDate: Thu Jun 28 18:40:32 2007 +0100

    [MTD] Only call mtd->sync() method in mtdchar close if opened for write.
    
    Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund at transmode.se>
    Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
---
 drivers/mtd/mtdchar.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 8c86b80..942c88e 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -135,7 +135,8 @@ static int mtd_close(struct inode *inode, struct file *file)
 
 	DEBUG(MTD_DEBUG_LEVEL0, "MTD_close\n");
 
-	if (mtd->sync)
+	/* Only sync if opened RW */
+	if ((file->f_mode & 2) && mtd->sync)
 		mtd->sync(mtd);
 
 	put_mtd_device(mtd);



More information about the linux-mtd-cvs mailing list