Skip to content

Commit 7e45bf8

Browse files
mitatorvalds
authored andcommitted
mtd: nandsim: use prandom_bytes
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> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 8376d0b commit 7e45bf8

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

‎drivers/mtd/nand/nandsim.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,10 +1397,7 @@ int do_read_error(struct nandsim *ns, int num)
13971397
unsigned int page_no = ns->regs.row;
13981398

13991399
if (read_error(page_no)) {
1400-
int i;
1401-
memset(ns->buf.byte, 0xFF, num);
1402-
for (i = 0; i < num; ++i)
1403-
ns->buf.byte[i] = random32();
1400+
prandom_bytes(ns->buf.byte, num);
14041401
NS_WARN("simulating read error in page %u\n", page_no);
14051402
return 1;
14061403
}

0 commit comments

Comments
 (0)