perf annotate: Fix arch specific ->init() failure errors
They are called from symbol__annotate() and to propagate errors that can help understand the problem make them return what symbol__strerror_disassemble() known, i.e. errno codes and other annotation specific errors in a special, out of errnos, range. Reported-by: Russell King - ARM Linux admin <linux@armlinux.org.uk> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org>, Cc: Will Deacon <will@kernel.org> Link: https://lkml.kernel.org/n/tip-pqx7srcv7tixgid251aeboj6@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
@@ -37,7 +37,7 @@ static int arm__annotate_init(struct arch *arch, char *cpuid __maybe_unused)
|
||||
|
||||
arm = zalloc(sizeof(*arm));
|
||||
if (!arm)
|
||||
return -1;
|
||||
return ENOMEM;
|
||||
|
||||
#define ARM_CONDS "(cc|cs|eq|ge|gt|hi|le|ls|lt|mi|ne|pl|vc|vs)"
|
||||
err = regcomp(&arm->call_insn, "^blx?" ARM_CONDS "?$", REG_EXTENDED);
|
||||
@@ -59,5 +59,5 @@ out_free_call:
|
||||
regfree(&arm->call_insn);
|
||||
out_free_arm:
|
||||
free(arm);
|
||||
return -1;
|
||||
return SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_REGEXP;
|
||||
}
|
||||
|
@@ -95,7 +95,7 @@ static int arm64__annotate_init(struct arch *arch, char *cpuid __maybe_unused)
|
||||
|
||||
arm = zalloc(sizeof(*arm));
|
||||
if (!arm)
|
||||
return -1;
|
||||
return ENOMEM;
|
||||
|
||||
/* bl, blr */
|
||||
err = regcomp(&arm->call_insn, "^blr?$", REG_EXTENDED);
|
||||
@@ -118,5 +118,5 @@ out_free_call:
|
||||
regfree(&arm->call_insn);
|
||||
out_free_arm:
|
||||
free(arm);
|
||||
return -1;
|
||||
return SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_REGEXP;
|
||||
}
|
||||
|
@@ -164,8 +164,10 @@ static int s390__annotate_init(struct arch *arch, char *cpuid __maybe_unused)
|
||||
if (!arch->initialized) {
|
||||
arch->initialized = true;
|
||||
arch->associate_instruction_ops = s390__associate_ins_ops;
|
||||
if (cpuid)
|
||||
err = s390__cpuid_parse(arch, cpuid);
|
||||
if (cpuid) {
|
||||
if (s390__cpuid_parse(arch, cpuid))
|
||||
err = SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_CPUID_PARSING;
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
|
@@ -196,8 +196,10 @@ static int x86__annotate_init(struct arch *arch, char *cpuid)
|
||||
if (arch->initialized)
|
||||
return 0;
|
||||
|
||||
if (cpuid)
|
||||
err = x86__cpuid_parse(arch, cpuid);
|
||||
if (cpuid) {
|
||||
if (x86__cpuid_parse(arch, cpuid))
|
||||
err = SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_CPUID_PARSING;
|
||||
}
|
||||
|
||||
arch->initialized = true;
|
||||
return err;
|
||||
|
Reference in New Issue
Block a user