diff mbox

[1/3] volatile-test: Fix purge flag bug

Message ID 1386807988-20278-1-git-send-email-john.stultz@linaro.org
State Accepted
Headers show

Commit Message

John Stultz Dec. 12, 2013, 12:26 a.m. UTC
This patch from Minchan fixes a bug with the purge flag
logic, where we end up overwriting the purge value with
whatever the last call returns. Instead we should OR
the results together to see if any data was purged.

Signed-off-by: John Stultz <john.stultz@linaro.org>
---
 volatile-test.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/volatile-test.c b/volatile-test.c
index 7f0599c..a25c564 100644
--- a/volatile-test.c
+++ b/volatile-test.c
@@ -100,7 +100,6 @@  int main(int argc, char *argv[])
 		vaddr = malloc(FULLSIZE);
 	}
 
-	purged = 0;
 	vaddr += PAGE_SIZE-1;
 	vaddr -= (long)vaddr % PAGE_SIZE;
 
@@ -116,8 +115,11 @@  int main(int argc, char *argv[])
 	printf("Generating %i megs of pressure\n", pressure);
 	generate_pressure(pressure);
 
+	purged = 0;
 	for(i=0; i < CHUNKNUM; ) {
-		mnovolatile(vaddr + (i*CHUNK), CHUNK, &purged);
+		int tmp_purged = 0;
+		mnovolatile(vaddr + (i*CHUNK), CHUNK, &tmp_purged);
+		purged |= tmp_purged;
 		i+=2;
 	}