From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pa0-f49.google.com ([209.85.220.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TYGgP-0005jf-Rv for linux-mtd@lists.infradead.org; Tue, 13 Nov 2012 13:37:46 +0000 Received: by mail-pa0-f49.google.com with SMTP id bi5so4642481pad.36 for ; Tue, 13 Nov 2012 05:37:41 -0800 (PST) From: Akinobu Mita To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org Subject: [PATCH v3 04/11] mtd: nandsim: use prandom_bytes Date: Tue, 13 Nov 2012 22:37:03 +0900 Message-Id: <1352813830-4624-5-git-send-email-akinobu.mita@gmail.com> In-Reply-To: <1352813830-4624-1-git-send-email-akinobu.mita@gmail.com> References: <1352813830-4624-1-git-send-email-akinobu.mita@gmail.com> Cc: linux-mtd@lists.infradead.org, David Woodhouse , Akinobu Mita , Artem Bityutskiy List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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: linux-mtd@lists.infradead.org --- * v3 - rename random32_get_bytes to prandom_bytes drivers/mtd/nand/nandsim.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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; } -- 1.7.11.7