[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>
This commit is contained in:
Joakim Tjernlund 2007-06-27 00:56:40 +02:00 committed by David Woodhouse
parent fd5324909e
commit 7eafaed55f

View File

@ -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);