Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf tools: Remove a trailing newline in the event terms

So that it can show the correct encoding info in the JSON output.

$ perf list -j hw
[
{
"Unit": "cpu",
"Topic": "legacy hardware",
"EventName": "branch-instructions",
"EventType": "Kernel PMU event",
"BriefDescription": "Retired branch instructions [This event is an alias of branches]",
"Encoding": "cpu/event=0xc4/"
},
...

Reviewed-by: Ian Rogers <irogers@google.com>
Suggested-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

+2
+2
tools/perf/util/pmu.c
··· 645 645 pr_err("Failed to read alias %s\n", name); 646 646 return ret; 647 647 } 648 + if (line_len >= 1 && alias->terms[line_len - 1] == '\n') 649 + alias->terms[line_len - 1] = '\0'; 648 650 } 649 651 alias->name = strdup(name); 650 652 alias->desc = desc ? strdup(desc) : NULL;