hikey: Check if governor is interactive to avoid errors am: cc14758ff0 am: 7fc8a007d7 am: aefe412f53
am: 03c34d997b
Change-Id: I46eb97d71da5c0f87a8fccabf8cd3bf879d637d8
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",