Skip to content

Commit

Permalink
perf tools: Be consistent on the type of map->symbols[] interator
Browse files Browse the repository at this point in the history
In a few cases we were using 'enum map_type' and that triggered this
warning when using clang:

  util/session.c:1923:16: error: comparison of constant 2 with expression of type 'enum map_type' is always true
      [-Werror,-Wtautological-constant-out-of-range-compare]
        for (i = 0; i < MAP__NR_TYPES; ++i) {

Cc: Adrian Hunter <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Wang Nan <[email protected]>
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
acmel committed Feb 14, 2017
1 parent 35670dd commit a0b2f5a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tools/perf/util/machine.c
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ static u64 machine__get_running_kernel_start(struct machine *machine,

int __machine__create_kernel_maps(struct machine *machine, struct dso *kernel)
{
enum map_type type;
int type;
u64 start = machine__get_running_kernel_start(machine, NULL);

/* In case of renewal the kernel map, destroy previous one */
Expand Down Expand Up @@ -813,7 +813,7 @@ int __machine__create_kernel_maps(struct machine *machine, struct dso *kernel)

void machine__destroy_kernel_maps(struct machine *machine)
{
enum map_type type;
int type;

for (type = 0; type < MAP__NR_TYPES; ++type) {
struct kmap *kmap;
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/util/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -1901,7 +1901,7 @@ int maps__set_kallsyms_ref_reloc_sym(struct map **maps,
const char *symbol_name, u64 addr)
{
char *bracket;
enum map_type i;
int i;
struct ref_reloc_sym *ref;

ref = zalloc(sizeof(struct ref_reloc_sym));
Expand Down

0 comments on commit a0b2f5a

Please sign in to comment.