diff options
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/symbol.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 78c2efde01b7..c077b6a14690 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -146,6 +146,7 @@ static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int verb | |||
146 | char *line = NULL; | 146 | char *line = NULL; |
147 | size_t n; | 147 | size_t n; |
148 | FILE *file = fopen("/proc/kallsyms", "r"); | 148 | FILE *file = fopen("/proc/kallsyms", "r"); |
149 | int count = 0; | ||
149 | 150 | ||
150 | if (file == NULL) | 151 | if (file == NULL) |
151 | goto out_failure; | 152 | goto out_failure; |
@@ -188,8 +189,10 @@ static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int verb | |||
188 | 189 | ||
189 | if (filter && filter(self, sym)) | 190 | if (filter && filter(self, sym)) |
190 | symbol__delete(sym, self->sym_priv_size); | 191 | symbol__delete(sym, self->sym_priv_size); |
191 | else | 192 | else { |
192 | dso__insert_symbol(self, sym); | 193 | dso__insert_symbol(self, sym); |
194 | count++; | ||
195 | } | ||
193 | } | 196 | } |
194 | 197 | ||
195 | /* | 198 | /* |
@@ -212,7 +215,7 @@ static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int verb | |||
212 | free(line); | 215 | free(line); |
213 | fclose(file); | 216 | fclose(file); |
214 | 217 | ||
215 | return 0; | 218 | return count; |
216 | 219 | ||
217 | out_delete_line: | 220 | out_delete_line: |
218 | free(line); | 221 | free(line); |
@@ -639,7 +642,7 @@ int dso__load_kernel(struct dso *self, const char *vmlinux, | |||
639 | if (vmlinux) | 642 | if (vmlinux) |
640 | err = dso__load_vmlinux(self, vmlinux, filter, verbose); | 643 | err = dso__load_vmlinux(self, vmlinux, filter, verbose); |
641 | 644 | ||
642 | if (err < 0) | 645 | if (err <= 0) |
643 | err = dso__load_kallsyms(self, filter, verbose); | 646 | err = dso__load_kallsyms(self, filter, verbose); |
644 | 647 | ||
645 | return err; | 648 | return err; |