From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pb0-f49.google.com ([209.85.160.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TUfta-0007eB-HL for linux-mtd@lists.infradead.org; Sat, 03 Nov 2012 15:44:27 +0000 Received: by mail-pb0-f49.google.com with SMTP id xa7so2829087pbc.36 for ; Sat, 03 Nov 2012 08:44:24 -0700 (PDT) From: Akinobu Mita To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org Subject: [PATCH v2 04/11] mtd: nandsim: use random32_get_bytes Date: Sun, 4 Nov 2012 00:43:35 +0900 Message-Id: <1351957422-23243-5-git-send-email-akinobu.mita@gmail.com> In-Reply-To: <1351957422-23243-1-git-send-email-akinobu.mita@gmail.com> References: <1351957422-23243-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 --- no change from v1 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..d074b4c 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(); + random32_get_bytes(ns->buf.byte, num); NS_WARN("simulating read error in page %u\n", page_no); return 1; } -- 1.7.11.7