Skip to content

Commit

Permalink
tools/power turbostat: Remove unnecessary fflush() call
Browse files Browse the repository at this point in the history
The graphics sysfs knobs are read-only, making the use of fflush()
before reading them redundant.

Remove the unnecessary fflush() call.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
  • Loading branch information
Zhang Rui authored and Len Brown committed Nov 30, 2024
1 parent 1958f4e commit ba99a4f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tools/power/x86/turbostat/turbostat.c
Original file line number Diff line number Diff line change
Expand Up @@ -5780,12 +5780,11 @@ int snapshot_graphics(int idx)
case GFX_ACTMHz:
case SAM_MHz:
case SAM_ACTMHz:
if (gfx_info[idx].fp == NULL) {
if (gfx_info[idx].fp == NULL)
gfx_info[idx].fp = fopen_or_die(gfx_info[idx].path, "r");
} else {
else
rewind(gfx_info[idx].fp);
fflush(gfx_info[idx].fp);
}

retval = fscanf(gfx_info[idx].fp, "%d", &gfx_info[idx].val);
if (retval != 1)
err(1, "MHz");
Expand Down

0 comments on commit ba99a4f

Please sign in to comment.