[PATCH 5.18 752/879] tracing: Initialize integer variable to prevent garbage return value

From: Greg Kroah-Hartman
Date: Tue Jun 07 2022 - 22:05:15 EST


From: Gautam Menghani <gautammenghani201@xxxxxxxxx>

commit 154827f8e53d8c492b3fb0cb757fbcadb5d516b5 upstream.

Initialize the integer variable to 0 to fix the clang scan warning:
Undefined or garbage value returned to caller
[core.uninitialized.UndefReturn]
return ret;

Link: https://lkml.kernel.org/r/20220522061826.1751-1-gautammenghani201@xxxxxxxxx

Cc: stable@xxxxxxxxxxxxxxx
Fixes: 8993665abcce ("tracing/boot: Support multiple handlers for per-event histogram")
Acked-by: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>
Signed-off-by: Gautam Menghani <gautammenghani201@xxxxxxxxx>
Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
kernel/trace/trace_boot.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kernel/trace/trace_boot.c
+++ b/kernel/trace/trace_boot.c
@@ -300,7 +300,7 @@ trace_boot_hist_add_handlers(struct xbc_
{
struct xbc_node *node;
const char *p, *handler;
- int ret;
+ int ret = 0;

handler = xbc_node_get_data(hnode);