Commit 75315d1c authored by David Woodhouse's avatar David Woodhouse

[MTD] Bug in 2.6.10 mtd driver for physmem mapped flash chips

The patch below fixes a small but fatal bug in the code that handles
non-buswidth-aligned writes. The problem is that the code used the same
index in both map_word and buf, therefore putting the wrong words in the
map_word that partially contains old data and partially contains new
data. The result: corrupt data is being written.
Signed-off-by: default avatarKoen Martens <kmartens@sonologic.nl>
Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
parent 1c66c552
/* Overhauled routines for dealing with different mmap regions of flash */
/* $Id: map.h,v 1.45 2004/09/21 14:31:17 bjd Exp $ */
/* $Id: map.h,v 1.46 2005/01/05 17:09:44 dwmw2 Exp $ */
#ifndef __LINUX_MTD_MAP_H__
#define __LINUX_MTD_MAP_H__
......@@ -322,7 +322,7 @@ static inline map_word map_word_load_partial(struct map_info *map, map_word orig
bitpos = (map_bankwidth(map)-1-i)*8;
#endif
orig.x[0] &= ~(0xff << bitpos);
orig.x[0] |= buf[i] << bitpos;
orig.x[0] |= buf[i-start] << bitpos;
}
}
return orig;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment