aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoakim Tjernlund <Joakim.Tjernlund@transmode.se>2007-06-27 00:56:40 +0200
committerDavid Woodhouse <dwmw2@infradead.org>2007-06-28 18:40:32 +0100
commit7eafaed55f4b8599cfe55449a6ed88d3693954de (patch)
treee18c5c5f660c1d3cdbaf31e731231e829638aa0b
parentfd5324909e410a3202c1b01bd507c2dfba58fca5 (diff)
[MTD] Only call mtd->sync() method in mtdchar close if opened for write.
Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
-rw-r--r--drivers/mtd/mtdchar.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 8c86b802f21..942c88ec5b6 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);