diff mbox

[i-g-t] perf_pmu: Fix some compile warnings with old compilers / 32-bit builds

Message ID 20180219100408.30246-1-tvrtko.ursulin@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tvrtko Ursulin Feb. 19, 2018, 10:04 a.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Correct printf format for uint64_t and one "may be uninitialized".

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reported-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/perf_pmu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Chris Wilson Feb. 19, 2018, 10:12 a.m. UTC | #1
Quoting Tvrtko Ursulin (2018-02-19 10:04:08)
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> Correct printf format for uint64_t and one "may be uninitialized".
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Reported-by: Chris Wilson <chris@chris-wilson.co.uk>

Fixing those two turned up one more!

In file included from ./../lib/igt.h:40:0,
                 from perf_pmu.c:40:
perf_pmu.c: In function ‘__real_main1547’:
./../lib/igt_gt.h:111:2: warning: ‘render_fd’ may be used uninitialized in this function [-Wmaybe-uninitialized]
perf_pmu.c:1761:7: note: ‘render_fd’ was declared here

This compiler is easily confused by longjmps

@@ -1758,7 +1758,7 @@ igt_main
         * Check render nodes are counted.
         */
        igt_subtest_group {
-               int render_fd;
+               int render_fd = -1;
 
Throw that in on top and have a 
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
diff mbox

Patch

diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c
index 82053416cbea..8d8dbe397df6 100644
--- a/tests/perf_pmu.c
+++ b/tests/perf_pmu.c
@@ -300,7 +300,7 @@  busy_double_start(int gem_fd, const struct intel_execution_engine2 *e)
 	usleep(batch_duration_ns / 1000);
 	val2 = pmu_read_single(fd) - val2;
 
-	igt_info("busy=%lu idle=%lu\n", val, val2);
+	igt_info("busy=%"PRIu64" idle=%"PRIu64"\n", val, val2);
 
 	igt_spin_batch_free(gem_fd, spin[0]);
 	igt_spin_batch_free(gem_fd, spin[1]);
@@ -340,11 +340,11 @@  busy_check_all(int gem_fd, const struct intel_execution_engine2 *e,
 {
 	const struct intel_execution_engine2 *e_;
 	uint64_t tval[2][num_engines];
+	unsigned int busy_idx = 0, i;
 	uint64_t val[num_engines];
 	int fd[num_engines];
 	unsigned long slept;
 	igt_spin_t *spin;
-	unsigned int busy_idx, i;
 
 	i = 0;
 	fd[0] = -1;