mtd: mtd_nandecctest: ensure alignment requirement for bitops
authorAkinobu Mita <akinobu.mita@gmail.com>
Mon, 3 Sep 2012 13:00:01 +0000 (22:00 +0900)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Sat, 29 Sep 2012 14:34:30 +0000 (15:34 +0100)
commit1749c00ffc909db4ebf1b2f17fd52cdb6e7b149c
tree2a4aa7b96f2aa66718500c7e96e734092864d000
parentc5b8384abc11fd566a3633b7bd7d476ff04c31af
mtd: mtd_nandecctest: ensure alignment requirement for bitops

Currently the data blocks which is used to test single bit error
correction is allocated statically and injecting single bit error is
implemented by using __change_bit() which must operate on the memory
aligned to the size of an "unsigned long".  But there is no such
guarantee for statically allocated array.

This fix the issue by allocating the data block dynamically by
kmalloc().  It also allocate the ecc code dynamically instead of
allocating statically on stack.

The reason to allocate the ecc code dynamically is that later change
will add tests which inject bit errors into the ecc code by bitops.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/tests/mtd_nandecctest.c