]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mtd: nandsim: use prandom_bytes
authorAkinobu Mita <akinobu.mita@gmail.com>
Thu, 15 Nov 2012 02:38:53 +0000 (13:38 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 15 Nov 2012 06:32:22 +0000 (17:32 +1100)
This also removes unnecessary memset call which is immediately overwritten
with random bytes.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Artem Bityutskiy <dedekind1@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Laight <david.laight@aculab.com>
Cc: Eilon Greenstein <eilong@broadcom.com>
Cc: Michel Lespinasse <walken@google.com>
Cc: Robert Love <robert.w.love@intel.com>
Cc: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/mtd/nand/nandsim.c

index a932c485eb04f9c7b40c14c924c7aa172be71244..c3c13e64a2f0c55117397ba9436ea35946669fd4 100644 (file)
@@ -1397,10 +1397,7 @@ int do_read_error(struct nandsim *ns, int num)
        unsigned int page_no = ns->regs.row;
 
        if (read_error(page_no)) {
-               int i;
-               memset(ns->buf.byte, 0xFF, num);
-               for (i = 0; i < num; ++i)
-                       ns->buf.byte[i] = random32();
+               prandom_bytes(ns->buf.byte, num);
                NS_WARN("simulating read error in page %u\n", page_no);
                return 1;
        }