From: Akinobu Mita Date: Tue, 18 Dec 2012 00:04:32 +0000 (-0800) Subject: mtd: nandsim: use prandom_bytes X-Git-Tag: upstream/snapshot3+hdmi~6031^2~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7e45bf83f4cee68f0cfa9599007f8e089ea53365;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git mtd: nandsim: use prandom_bytes This also removes unnecessary memset call which is immediately overwritten with random bytes. Signed-off-by: Akinobu Mita Cc: Artem Bityutskiy Cc: David Woodhouse Cc: "Theodore Ts'o" Cc: Adrian Hunter Cc: David Laight Cc: Eilon Greenstein Cc: Michel Lespinasse Cc: Robert Love Cc: Valdis Kletnieks Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c index a932c48..c3c13e6 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; }