[PATCH 5/8] nandtest: use get_random_bytes instead of for loop

Alexander Aring alex.aring at googlemail.com
Mon Oct 22 03:23:29 EDT 2012


Use already builtin get_random_bytes instead of for loop.

Signed-off-by: Alexander Aring <alex.aring at gmail.com>
---
 commands/nandtest.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/commands/nandtest.c b/commands/nandtest.c
index e25f062..cdf9c31 100644
--- a/commands/nandtest.c
+++ b/commands/nandtest.c
@@ -198,7 +198,6 @@ static int do_nandtest(int argc, char *argv[])
 	int opt, do_nandtest_dev = -1;
 	off_t flash_offset = 0, test_ofs, length = 0;
 	unsigned int nr_iterations = 1, iter;
-	int i;
 	int ret = -1;
 	unsigned char *wbuf, *rbuf;
 
@@ -328,9 +327,7 @@ static int do_nandtest(int argc, char *argv[])
 				continue;
 			}
 
-			for (i = 0; i < meminfo.erasesize; i++)
-				wbuf[i] = rand();
-
+			get_random_bytes(wbuf, meminfo.erasesize);
 			ret = erase_and_write(test_ofs, wbuf,
 					rbuf, length);
 			if (ret < 0)
-- 
1.7.12.4




More information about the barebox mailing list