[PATCH] bios: mtrr: fix compile error in ubuntu trusty

Alex Hung alex.hung at canonical.com
Fri Jun 9 20:26:51 UTC 2017


This is to fix the below error

bios/mtrr/mtrr.c:368:2: error: ‘for’ loop initial declarations are only
allowed in C99 mode
  for (int i = 0; i < 5; i++) {

Signed-off-by: Alex Hung <alex.hung at canonical.com>
---
 src/bios/mtrr/mtrr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/bios/mtrr/mtrr.c b/src/bios/mtrr/mtrr.c
index 6386b6e..dfc3c6a 100644
--- a/src/bios/mtrr/mtrr.c
+++ b/src/bios/mtrr/mtrr.c
@@ -362,10 +362,10 @@ static int guess_cache_type(
 
 void multi_types_check(fwts_framework *fw, int *type)
 {
-	int n_types = 0;
+	int n_types = 0, i;
 
 	/* checking number fo types set, UNCACHED, WRITE_BACK, WRITE_COMBINING, WRITE_THROUGH, WRITE_PROTECT */
-	for (int i = 0; i < 5; i++) {
+	for (i = 0; i < 5; i++) {
 		if (*type & (1 << i))
 			n_types++;
 	}
-- 
2.7.4




More information about the fwts-devel mailing list