mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-26 04:20:23 +09:00
bpftool: Fix maybe-uninitialized warnings
[ Upstream commit4bbb358368] Somehow when bpftool is compiled in -Og mode, compiler produces new warnings about possibly uninitialized variables. Fix all the reported problems. Fixes:2119f2189d("bpftool: add C output format option to btf dump subcommand") Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20210313210920.1959628-3-andrii@kernel.org Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
b1ed7a5717
commit
3d15bf2b2c
@@ -519,6 +519,7 @@ static int do_dump(int argc, char **argv)
|
||||
NEXT_ARG();
|
||||
if (argc < 1) {
|
||||
p_err("expecting value for 'format' option\n");
|
||||
err = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
if (strcmp(*argv, "c") == 0) {
|
||||
@@ -528,11 +529,13 @@ static int do_dump(int argc, char **argv)
|
||||
} else {
|
||||
p_err("unrecognized format specifier: '%s', possible values: raw, c",
|
||||
*argv);
|
||||
err = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
NEXT_ARG();
|
||||
} else {
|
||||
p_err("unrecognized option: '%s'", *argv);
|
||||
err = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,7 +274,7 @@ static int do_batch(int argc, char **argv)
|
||||
int n_argc;
|
||||
FILE *fp;
|
||||
char *cp;
|
||||
int err;
|
||||
int err = 0;
|
||||
int i;
|
||||
|
||||
if (argc < 2) {
|
||||
@@ -368,7 +368,6 @@ static int do_batch(int argc, char **argv)
|
||||
} else {
|
||||
if (!json_output)
|
||||
printf("processed %d commands\n", lines);
|
||||
err = 0;
|
||||
}
|
||||
err_close:
|
||||
if (fp != stdin)
|
||||
|
||||
@@ -99,7 +99,7 @@ static int do_dump_btf(const struct btf_dumper *d,
|
||||
void *value)
|
||||
{
|
||||
__u32 value_id;
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
/* start of key-value pair */
|
||||
jsonw_start_object(d->jw);
|
||||
|
||||
Reference in New Issue
Block a user