[PATCH] mtd: cfi_cmdset_0002: Initialize datum before calling map_word_load_partial
Brian Norris
computersforpeace at gmail.com
Wed May 27 12:56:23 PDT 2015
Hi Christian,
On Thu, May 07, 2015 at 12:32:03PM +0200, Christian Riesch wrote:
> On Thu, May 7, 2015 at 9:02 AM, Brian Norris
> <computersforpeace at gmail.com> wrote:
> > On Tue, Mar 31, 2015 at 11:29:22PM +0200, Christian Riesch wrote:
> >> In do_otp_write we must initialize the variable datum before calling
> >> map_word_load_partial. Otherwise the upper bits of datum may be undefined,
> >> which later causes problems in chip_good called by do_write_oneword.
> >
> > Hmm, are you sure this is actually the problem? It looks to me like the
> > logic for the "partial write of a word, load old contents" block means
> > that we *will* initialize datum with old contents, if we're not aligned.
>
> That's right. But if we are aligned, datum will not be initialized, at
> least not in every case.
>
> > So your initialization actually looks redundant.
> >
> > Or please help explain, if I'm wrong.
>
> This is from do_otp_write():
[snip]
> Without initialization, unaligned writes work fine, whereas aligned writes fail.
OK, thanks for the more thorough explanation. Makes sense. Applied to
l2-mtd.git.
Brian
More information about the linux-mtd
mailing list