summaryrefslogtreecommitdiff
authorbaocheng.sun <baocheng.sun@amlogic.com>2014-11-12 06:48:24 (GMT)
committer baocheng.sun <baocheng.sun@amlogic.com>2014-11-12 06:54:40 (GMT)
commitdbae29238ba9a582281cdb172995db7576b79ceb (patch)
tree70924a700b3ab3a7580c1489a7305e5b05e3e511
parenta4a45f7f4238938be19604f8114c11008dd31fcb (diff)
downloadpower-dbae29238ba9a582281cdb172995db7576b79ceb.zip
power-dbae29238ba9a582281cdb172995db7576b79ceb.tar.gz
power-dbae29238ba9a582281cdb172995db7576b79ceb.tar.bz2
pd#99357: change initialization value of fd to an invalid value -1
Diffstat
-rwxr-xr-xpower.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/power.c b/power.c
index c4d320d..d224a83 100755
--- a/power.c
+++ b/power.c
@@ -47,7 +47,7 @@ static void power_hint(struct power_module *module, power_hint_t hint,
const char *val = "preheat";
static int bytes = 7;
- if (pm->fp == 0) {
+ if (pm->fp == -1) {
pm->fp = open("/sys/class/mpgpu/mpgpucmd", O_RDWR, 0644);
if (DEBUG) {
ALOGD("open file /sys/class/mpgpu/mpgpucmd,fd is %d", pm->fp);
@@ -56,7 +56,7 @@ static void power_hint(struct power_module *module, power_hint_t hint,
switch (hint) {
case POWER_HINT_INTERACTION:
- if (pm->fp > 0) {
+ if (pm->fp >= 0) {
int len = write(pm->fp, val, bytes);
if (DEBUG) {
ALOGD("%s: write sucessfull, fd is %d\n", __FUNCTION__, pm->fp);
@@ -91,5 +91,5 @@ struct private_power_module HAL_MODULE_INFO_SYM = {
.setInteractive = power_set_interactive,
.powerHint = power_hint,
},
- .fp = 0,
+ .fp = -1,
};