linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] riscv: perf: fix build warning
@ 2018-11-25 22:51 Olof Johansson
  0 siblings, 0 replies; only message in thread
From: Olof Johansson @ 2018-11-25 22:51 UTC (permalink / raw)
  To: Palmer Dabbelt, Albert Ou; +Cc: linux-kernel, linux-riscv, Olof Johansson

Due to the -ENOENT return, the variables can't actually be used
uninitialized, but the compiler isn't smart enough in this case.

Let's just set them before returning with the error for now, it'll be
filled in once implemented.

arch/riscv/kernel/perf_event.c:166:5: warning: 'type' may be used uninitialized in this function [-Wmaybe-uninitialized]
arch/riscv/kernel/perf_event.c:166:38: warning: 'op' may be used uninitialized in this function [-Wmaybe-uninitialized]
arch/riscv/kernel/perf_event.c:167:39: warning: 'result' may be used uninitialized in this function [-Wmaybe-uninitialized]

Signed-off-by: Olof Johansson <olof@lixom.net>
---

I swear I posted this exact fix just last week, but can't find a reference
to it anywhere.

 arch/riscv/kernel/perf_event.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/riscv/kernel/perf_event.c b/arch/riscv/kernel/perf_event.c
index a243fae1c1dbb..81f3ba76f1dbc 100644
--- a/arch/riscv/kernel/perf_event.c
+++ b/arch/riscv/kernel/perf_event.c
@@ -150,6 +150,9 @@ static int riscv_map_hw_event(u64 config)
 int riscv_map_cache_decode(u64 config, unsigned int *type,
 			   unsigned int *op, unsigned int *result)
 {
+	*type = 0;
+	*op = 0;
+	*result = 0;
 	return -ENOENT;
 }
 
-- 
2.11.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-11-25 22:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-25 22:51 [PATCH] riscv: perf: fix build warning Olof Johansson

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).