aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtdchar.c
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 /drivers/mtd/mtdchar.c
parentfd5324909e410a3202c1b01bd507c2dfba58fca5 (diff)
downloadkernel_samsung_smdk4412-7eafaed55f4b8599cfe55449a6ed88d3693954de.zip
kernel_samsung_smdk4412-7eafaed55f4b8599cfe55449a6ed88d3693954de.tar.gz
kernel_samsung_smdk4412-7eafaed55f4b8599cfe55449a6ed88d3693954de.tar.bz2
[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 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);