Skip to content

Commit 11c1ea6

Browse files
changbinduacmel
authored andcommitted
perf tools: Fix errors under optimization level '-Og'
Optimization level '-Og' offers a reasonable level of optimization while maintaining fast compilation and a good debugging experience. This patch tries to make it work. $ make DEBUG=1 EXTRA_CFLAGS='-Og' bench/epoll-ctl.c: In function ‘do_threads’: bench/epoll-ctl.c:274:9: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized] return ret; ^~~ ... Signed-off-by: Changbin Du <[email protected]> Reviewed-by: Jiri Olsa <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Daniel Borkmann <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt (VMware) <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 39df730 commit 11c1ea6

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

tools/lib/bpf/libbpf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ bpf_object__init_maps(struct bpf_object *obj, int flags)
622622
bool strict = !(flags & MAPS_RELAX_COMPAT);
623623
int i, map_idx, map_def_sz, nr_maps = 0;
624624
Elf_Scn *scn;
625-
Elf_Data *data;
625+
Elf_Data *data = NULL;
626626
Elf_Data *symbols = obj->efile.symbols;
627627

628628
if (obj->efile.maps_shndx < 0)

tools/perf/bench/epoll-ctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ static int do_threads(struct worker *worker, struct cpu_map *cpu)
224224
pthread_attr_t thread_attr, *attrp = NULL;
225225
cpu_set_t cpuset;
226226
unsigned int i, j;
227-
int ret;
227+
int ret = 0;
228228

229229
if (!noaffinity)
230230
pthread_attr_init(&thread_attr);

tools/perf/bench/epoll-wait.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ static int do_threads(struct worker *worker, struct cpu_map *cpu)
293293
pthread_attr_t thread_attr, *attrp = NULL;
294294
cpu_set_t cpuset;
295295
unsigned int i, j;
296-
int ret, events = EPOLLIN;
296+
int ret = 0, events = EPOLLIN;
297297

298298
if (oneshot)
299299
events |= EPOLLONESHOT;

tools/perf/tests/backward-ring-buffer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ static void testcase(void)
1818
int i;
1919

2020
for (i = 0; i < NR_ITERS; i++) {
21-
char proc_name[10];
21+
char proc_name[15];
2222

2323
snprintf(proc_name, sizeof(proc_name), "p:%d\n", i);
2424
prctl(PR_SET_NAME, proc_name);

0 commit comments

Comments
 (0)