Skip to content

Commit

Permalink
[MTD] Only call mtd->sync() method in mtdchar close if opened for write.
Browse files Browse the repository at this point in the history
Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
  • Loading branch information
Joakim Tjernlund authored and David Woodhouse committed Jun 28, 2007
1 parent fd53249 commit 7eafaed
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/mtd/mtdchar.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7eafaed

Please sign in to comment.