summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2023-01-26 15:36:31 -0800
committerArnaldo Carvalho de Melo <acme@redhat.com>2023-02-02 17:18:31 -0300
commit3241cd11d9a093783a97cea7136179206553fa86 (patch)
treef615a49e15eaa9237643cd1e03fe3d86a434f7da
parent8eaf8ec3c09b88e35c1c3c761ac4188ee425aeb6 (diff)
downloadlinux-stable-3241cd11d9a093783a97cea7136179206553fa86.tar.gz
linux-stable-3241cd11d9a093783a97cea7136179206553fa86.tar.bz2
linux-stable-3241cd11d9a093783a97cea7136179206553fa86.zip
perf jevents metric: Correct Function equality
rhs may not be defined, say for source_count, so add a guard. Reviewed-by: Kajol Jain <kjain@linux.ibm.com> Signed-off-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Caleb Biggers <caleb.biggers@intel.com> Cc: Florian Fischer <florian.fischer@muhq.space> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@arm.com> Cc: Jing Zhang <renyu.zj@linux.alibaba.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: John Garry <john.g.garry@oracle.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Kang Minchul <tegongkang@gmail.com> Cc: Kim Phillips <kim.phillips@amd.com> Cc: Leo Yan <leo.yan@linaro.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mike Leach <mike.leach@linaro.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Perry Taylor <perry.taylor@intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ravi Bangoria <ravi.bangoria@amd.com> Cc: Rob Herring <robh@kernel.org> Cc: Sandipan Das <sandipan.das@amd.com> Cc: Stephane Eranian <eranian@google.com> Cc: Will Deacon <will@kernel.org> Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com> Cc: linux-arm-kernel@lists.infradead.org Cc: linuxppc-dev@lists.ozlabs.org Link: https://lore.kernel.org/r/20230126233645.200509-2-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/pmu-events/metric.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/perf/pmu-events/metric.py b/tools/perf/pmu-events/metric.py
index 4797ed4fd817..2f2fd220e843 100644
--- a/tools/perf/pmu-events/metric.py
+++ b/tools/perf/pmu-events/metric.py
@@ -261,8 +261,10 @@ class Function(Expression):
def Equals(self, other: Expression) -> bool:
if isinstance(other, Function):
- return self.fn == other.fn and self.lhs.Equals(
- other.lhs) and self.rhs.Equals(other.rhs)
+ result = self.fn == other.fn and self.lhs.Equals(other.lhs)
+ if self.rhs:
+ result = result and self.rhs.Equals(other.rhs)
+ return result
return False