Commit 7e45bf83 authored by Akinobu Mita's avatar Akinobu Mita Committed by Linus Torvalds

mtd: nandsim: use prandom_bytes

This also removes unnecessary memset call which is immediately overwritten
with random bytes.
Signed-off-by: default avatarAkinobu 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 8376d0bc
...@@ -1397,10 +1397,7 @@ int do_read_error(struct nandsim *ns, int num) ...@@ -1397,10 +1397,7 @@ int do_read_error(struct nandsim *ns, int num)
unsigned int page_no = ns->regs.row; unsigned int page_no = ns->regs.row;
if (read_error(page_no)) { if (read_error(page_no)) {
int i; prandom_bytes(ns->buf.byte, num);
memset(ns->buf.byte, 0xFF, num);
for (i = 0; i < num; ++i)
ns->buf.byte[i] = random32();
NS_WARN("simulating read error in page %u\n", page_no); NS_WARN("simulating read error in page %u\n", page_no);
return 1; return 1;
} }
......
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