diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-08-23 16:02:42 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-08-23 16:07:04 +0100 |
commit | 1b6480114e368bcbda394e09b698268b356c1f8f (patch) | |
tree | 43f7e479b4b621972d1c4fe5fbdd435ae4d857f1 /overlay | |
parent | b22e90bc8b9c7fe27556558c31f00e35e689a12e (diff) |
overlay: Fix power reading from debugfs
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'overlay')
-rw-r--r-- | overlay/power.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/overlay/power.c b/overlay/power.c index 62aba8b5..520a1099 100644 --- a/overlay/power.c +++ b/overlay/power.c @@ -53,6 +53,10 @@ int power_init(struct power *power) if (len < 0) return power->error = errno; + buf[len] = '\0'; + if (strtoull(buf, 0, 0) == 0) + return power->error = EINVAL; + return 0; } @@ -61,7 +65,7 @@ static uint64_t file_to_u64(const char *name) char buf[4096]; int fd, len; - sprintf(buf, "%s/i915_energy_uJ", name); + sprintf(buf, "%s/%s", debugfs_dri_path, name); fd = open(buf, 0); if (fd < 0) return 0; |