power: Fix compilation failure
authorEthan Chen <intervigil@gmail.com>
Wed, 13 Jul 2016 01:38:00 +0000 (18:38 -0700)
committerEthan Chen <intervigil@gmail.com>
Wed, 13 Jul 2016 01:38:00 +0000 (18:38 -0700)
Change-Id: Ib0923ba5c0976e2d00e6f190b370936a14a9b6df

power/power.c

index f54c72ffc5ade38e627845adae164d297af7a5a4..3cf9cc217b59abc4304c349d382be251e476a2d1 100644 (file)
@@ -125,7 +125,7 @@ static void sysfs_write(const char *path, char *s)
 }
 
 static unsigned int read_panel_brightness() {
-    unsigned int ret = 0;
+    unsigned int i, ret = 0;
     int read_status;
     // brightness can range from 0 to 255, so max. 3 chars + '\0'
     char panel_brightness[4];
@@ -136,7 +136,7 @@ static unsigned int read_panel_brightness() {
         return -1;
     }
 
-    for (unsigned int i = 0; i < (sizeof(panel_brightness) / sizeof(panel_brightness[0])); i++) {
+    for (i = 0; i < (sizeof(panel_brightness) / sizeof(panel_brightness[0])); i++) {
         if (isdigit(panel_brightness[i])) {
             ret += (panel_brightness[i] - '0');
         }