hikey: Check if governor is interactive to avoid errors
am: cc14758ff0

Change-Id: I50ad0f4323a1598d211ad7259aa5594278a5363f
diff --git a/power/power_hikey.c b/power/power_hikey.c
index 5143cb7..e9a5248 100644
--- a/power/power_hikey.c
+++ b/power/power_hikey.c
@@ -71,7 +71,7 @@
     ((struct_name *)((char *)(addr) - offsetof(struct_name, field_name)))
 
 
-static void sysfs_write(const char *path, char *s)
+static int sysfs_write(const char *path, char *s)
 {
     char buf[80];
     int len;
@@ -80,7 +80,7 @@
     if (fd < 0) {
         strerror_r(errno, buf, sizeof(buf));
         ALOGE("Error opening %s: %s\n", path, buf);
-        return;
+        return fd;
     }
 
     len = write(fd, s, strlen(s));
@@ -90,6 +90,7 @@
     }
 
     close(fd);
+    return len;
 }
 
 #define NSEC_PER_SEC 1000000000LL
@@ -114,8 +115,9 @@
 {
     int32_t is_svelte = property_get_int32(SVELTE_PROP, 0);
 
-    sysfs_write("/sys/devices/system/cpu/cpufreq/interactive/timer_rate",
-                "20000");
+    if (sysfs_write("/sys/devices/system/cpu/cpufreq/interactive/timer_rate",
+                "20000") < 0)
+        return;
     sysfs_write("/sys/devices/system/cpu/cpufreq/interactive/timer_slack",
                 "20000");
     sysfs_write("/sys/devices/system/cpu/cpufreq/interactive/min_sample_time",