tools/perf/tests: Remove duplicate evlist__delete in tests/tool_pmu.c
authorAthira Rajeev <atrajeev@linux.vnet.ibm.com>
Sun, 13 Oct 2024 17:07:32 +0000 (22:37 +0530)
committerNamhyung Kim <namhyung@kernel.org>
Mon, 14 Oct 2024 17:29:55 +0000 (10:29 -0700)
The testcase for tool_pmu failed in powerpc as below:

 ./perf test -v "Parsing without PMU name"
  8: Tool PMU                                                        :
  8.1: Parsing without PMU name                                      : FAILED!

This happens when parse_events results in either skip or fail
of an event. Because the code invokes evlist__delete(evlist)
and "goto out".

ret = parse_events(evlist, str, &err);
if (ret) {
 evlist__delete(evlist);

But in the "out" section also evlist__delete happens.

out:
        evlist__delete(evlist);
        return ret;

Hence remove the duplicate evlist__delete from the first path
in the testcase

With the change:
# ./perf test -v "Parsing without PMU name"
  8: Tool PMU                                                        :
  8.1: Parsing without PMU name                                      : Ok

Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: akanksha@linux.ibm.com
Cc: hbathini@linux.ibm.com
Cc: kjain@linux.ibm.com
Cc: maddy@linux.ibm.com
Cc: disgoel@linux.vnet.ibm.com
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20241013170732.71339-1-atrajeev@linux.vnet.ibm.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/tests/tool_pmu.c

index 297cc8c555791db8537683cb4f537501b2469cec..46896b485abf34da20a4d6320a133a6cb2cbbf4b 100644 (file)
@@ -27,7 +27,6 @@ static int do_test(enum tool_pmu_event ev, bool with_pmu)
        parse_events_error__init(&err);
        ret = parse_events(evlist, str, &err);
        if (ret) {
-               evlist__delete(evlist);
                if (tool_pmu__skip_event(tool_pmu__event_to_str(ev))) {
                        ret = TEST_OK;
                        goto out;