All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ian Rogers" <irogers@google.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v7 1/2] perf tests: Add test for uncore event sorting
Date: Mon, 18 May 2026 04:48:14 +0000	[thread overview]
Message-ID: <20260518044815.7F50EC4AF1C@smtp.kernel.org> (raw)
In-Reply-To: <20260518043140.2522141-2-irogers@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Unreachable else block in event_cb().
--

commit 73f78d43a9da9383b1db8bb57a775b964c9f8810
Author: Ian Rogers <irogers@google.com>

perf tests: Add test for uncore event sorting

Add a test for uncore event sorting matching multiple PMUs. Uncore PMUs
may have a common prefix, and parsing an event group for those PMUs
should result in correctly sorted evsels.

> diff --git a/tools/perf/tests/uncore-event-sorting.c b/tools/perf/tests/uncore-event-sorting.c
> new file mode 100644
> index 0000000000000..594fe7ff7bf6a
> --- /dev/null
> +++ b/tools/perf/tests/uncore-event-sorting.c

[ ... ]

> +static int event_cb(void *state, struct pmu_event_info *info)
> +{
> +	struct match_state *m = state;
> +	char *clean_name;
> +
> +	if (m->event1 && m->event2)
> +		return 1;
> +
> +	clean_name = clean_event_name(info);
> +	if (!clean_name)
> +		return 0;
> +
> +	if (!m->event1) {
> +		m->event1 = clean_name;
> +	} else if (!m->event2) {
> +		if (strcmp(m->event1, clean_name)) {
> +			m->event2 = clean_name;
> +			return 1;
> +		}
> +		free(clean_name);
> +	} else {
> +		free(clean_name);
> +	}

Is this else block unreachable?

Since there is an early return at the start of the function when both
m->event1 and m->event2 are non-NULL, we can only reach this point if at
least one of them is NULL.

If the first branch (!m->event1) is not taken, m->event1 is non-NULL.
If the second branch (!m->event2) is not taken, m->event2 is non-NULL.

This implies both are non-NULL, which would have triggered the early return
at the top of the function, leaving this block as dead code.

> +	return 0;
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260518043140.2522141-1-irogers@google.com?part=1

  reply	other threads:[~2026-05-18  4:48 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-25 18:30 [PATCH v1 0/2] perf tests: Add tests for uncore and perf metric event sorting Ian Rogers
2026-03-25 18:30 ` [PATCH v1 1/2] perf tests: Add test for uncore " Ian Rogers
2026-03-27 23:36   ` Chen, Zide
2026-03-31  3:06     ` Namhyung Kim
2026-03-25 18:30 ` [PATCH v1 2/2] perf arch x86 tests: Add test for topdown " Ian Rogers
2026-03-30 21:53   ` Chen, Zide
2026-03-31  3:08     ` Namhyung Kim
2026-03-31 16:52       ` [PATCH v2 0/2] perf tests: Add tests for uncore and perf metric " Ian Rogers
2026-03-31 16:52         ` [PATCH v2 1/2] perf tests: Add test for uncore " Ian Rogers
2026-03-31 16:52         ` [PATCH v2 2/2] perf arch x86 tests: Add test for topdown " Ian Rogers
2026-03-31 18:54         ` [PATCH v3 0/2] Add tests for uncore and perf metric " Ian Rogers
2026-03-31 18:54           ` [PATCH v3 1/2] perf tests: Add test for uncore " Ian Rogers
2026-04-01 21:48             ` Namhyung Kim
2026-03-31 18:54           ` [PATCH v3 2/2] perf arch x86 tests: Add test for topdown " Ian Rogers
2026-04-01  3:33             ` Namhyung Kim
2026-05-17 23:28           ` [PATCH v4 0/2] perf tests: Add uncore and x86 topdown event sorting tests Ian Rogers
2026-05-17 23:28             ` [PATCH v4 1/2] perf tests: Add test for uncore event sorting Ian Rogers
2026-05-17 23:49               ` sashiko-bot
2026-05-17 23:28             ` [PATCH v4 2/2] perf arch x86 tests: Add test for topdown " Ian Rogers
2026-05-18  0:05               ` sashiko-bot
2026-05-18  0:37             ` [PATCH v5 0/2] perf tests: Add uncore and x86 topdown event sorting tests Ian Rogers
2026-05-18  0:37               ` [PATCH v5 1/2] perf tests: Add test for uncore event sorting Ian Rogers
2026-05-18  1:06                 ` sashiko-bot
2026-05-18  0:37               ` [PATCH v5 2/2] perf arch x86 tests: Add test for topdown " Ian Rogers
2026-05-18  1:20                 ` sashiko-bot
2026-05-18  2:32               ` [PATCH v6 0/2] perf tests: Add uncore and x86 topdown event sorting tests Ian Rogers
2026-05-18  2:32                 ` [PATCH v6 1/2] perf tests: Add test for uncore event sorting Ian Rogers
2026-05-18  2:53                   ` sashiko-bot
2026-05-18  2:32                 ` [PATCH v6 2/2] perf arch x86 tests: Add test for topdown " Ian Rogers
2026-05-18  3:08                   ` sashiko-bot
2026-05-18  4:31                 ` [PATCH v7 0/2] perf tests: Add uncore and x86 topdown event sorting tests Ian Rogers
2026-05-18  4:31                   ` [PATCH v7 1/2] perf tests: Add test for uncore event sorting Ian Rogers
2026-05-18  4:48                     ` sashiko-bot [this message]
2026-05-18  4:31                   ` [PATCH v7 2/2] perf arch x86 tests: Add test for topdown " Ian Rogers
2026-05-18  6:29                   ` [PATCH v8 0/2] perf tests: Add uncore and x86 topdown event sorting tests Ian Rogers
2026-05-18  6:29                     ` [PATCH v8 1/2] perf tests: Add test for uncore event sorting Ian Rogers
2026-05-18  6:29                     ` [PATCH v8 2/2] perf arch x86 tests: Add test for topdown " Ian Rogers
2026-05-20 15:31                     ` [PATCH v8 0/2] perf tests: Add uncore and x86 topdown event sorting tests Ian Rogers
2026-05-20 20:28                       ` Namhyung Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260518044815.7F50EC4AF1C@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=irogers@google.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.