From: Joakim Tjernlund Date: Tue, 26 Jun 2007 22:56:40 +0000 (+0200) Subject: [MTD] Only call mtd->sync() method in mtdchar close if opened for write. X-Git-Tag: v2.6.24-rc1~1364^2~96 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=7eafaed55f4b8599cfe55449a6ed88d3693954de;p=linux.git [MTD] Only call mtd->sync() method in mtdchar close if opened for write. Signed-off-by: Joakim Tjernlund Signed-off-by: David Woodhouse --- 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) 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);