aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkinobu Mita <[email protected]>2012-12-17 16:04:32 -0800
committerLinus Torvalds <[email protected]>2012-12-17 17:15:26 -0800
commit7e45bf83f4cee68f0cfa9599007f8e089ea53365 (patch)
tree9edd6626c79531487ce7f2ee93642aca9935c8e3
parent8376d0bccde3cf739649ea8559f7bedb4b5583b7 (diff)
mtd: nandsim: use prandom_bytes
This also removes unnecessary memset call which is immediately overwritten with random bytes. Signed-off-by: Akinobu Mita <[email protected]> Cc: Artem Bityutskiy <[email protected]> Cc: David Woodhouse <[email protected]> Cc: "Theodore Ts'o" <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: David Laight <[email protected]> Cc: Eilon Greenstein <[email protected]> Cc: Michel Lespinasse <[email protected]> Cc: Robert Love <[email protected]> Cc: Valdis Kletnieks <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r--drivers/mtd/nand/nandsim.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index a932c485eb04..c3c13e64a2f0 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -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;
}