linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf tools: Fixing uninitialised variable
@ 2018-01-22 22:17 Mathieu Poirier
  2018-01-23 19:36 ` Kim Phillips
  0 siblings, 1 reply; 2+ messages in thread
From: Mathieu Poirier @ 2018-01-22 22:17 UTC (permalink / raw)
  To: acme
  Cc: peterz, mingo, alexander.shishkin, jolsa, namhyung, kim.phillips,
	linux-kernel

When working natively on arm64 the compiler gets pesky and complains
that variable 'i' is uninitialised, something that breaks the
compilation.  Here no further checks are needed since variable 'found_spe'
can only be true if variable 'i' has been initialised as part of the for
loop.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
 tools/perf/arch/arm/util/auxtrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/arch/arm/util/auxtrace.c b/tools/perf/arch/arm/util/auxtrace.c
index 2323581b157d..fa639e3e52ac 100644
--- a/tools/perf/arch/arm/util/auxtrace.c
+++ b/tools/perf/arch/arm/util/auxtrace.c
@@ -68,7 +68,7 @@ struct auxtrace_record
 	bool found_spe = false;
 	static struct perf_pmu **arm_spe_pmus = NULL;
 	static int nr_spes = 0;
-	int i;
+	int i = 0;
 
 	if (!evlist)
 		return NULL;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] perf tools: Fixing uninitialised variable
  2018-01-22 22:17 [PATCH] perf tools: Fixing uninitialised variable Mathieu Poirier
@ 2018-01-23 19:36 ` Kim Phillips
  0 siblings, 0 replies; 2+ messages in thread
From: Kim Phillips @ 2018-01-23 19:36 UTC (permalink / raw)
  To: Mathieu Poirier
  Cc: acme, peterz, mingo, alexander.shishkin, jolsa, namhyung, linux-kernel

On Mon, 22 Jan 2018 15:17:40 -0700
Mathieu Poirier <mathieu.poirier@linaro.org> wrote:

> When working natively on arm64 the compiler gets pesky and complains

FWIW, I've only seen this on ARCH=arm64 builds with gcc versions less
than 5, i.e, 4.8.5.

> that variable 'i' is uninitialised, something that breaks the
> compilation.

It'd be nice to include the full compiler error message, to help users
searching for how to fix the error.

>  Here no further checks are needed since variable 'found_spe'
> can only be true if variable 'i' has been initialised as part of the for
> loop.
> 
> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> ---

Cc'ing me and adding a:

Fixes: ffd3d18c20b8 ("perf tools: Add ARM Statistical Profiling Extensions (SPE) support")

line would also be nice.

Other than those nits:

Acked-by: Kim Phillips <kim.phillips@arm.com>

Thanks!

Kim

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-23 19:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-22 22:17 [PATCH] perf tools: Fixing uninitialised variable Mathieu Poirier
2018-01-23 19:36 ` Kim Phillips

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).