aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtdchar.c
diff options
context:
space:
mode:
authorJoakim Tjernlund <Joakim.Tjernlund@transmode.se>2007-06-26 18:56:40 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2007-06-28 13:40:32 -0400
commit7eafaed55f4b8599cfe55449a6ed88d3693954de (patch)
treee18c5c5f660c1d3cdbaf31e731231e829638aa0b /drivers/mtd/mtdchar.c
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>
Diffstat (limited to 'drivers/mtd/mtdchar.c')
-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 8c86b802f212..942c88ec5b6a 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)
135 135
136 DEBUG(MTD_DEBUG_LEVEL0, "MTD_close\n"); 136 DEBUG(MTD_DEBUG_LEVEL0, "MTD_close\n");
137 137
138 if (mtd->sync) 138 /* Only sync if opened RW */
139 if ((file->f_mode & 2) && mtd->sync)
139 mtd->sync(mtd); 140 mtd->sync(mtd);
140 141
141 put_mtd_device(mtd); 142 put_mtd_device(mtd);