Skip to content

Commit

Permalink
perf: Fix IS_ERR() vs NULL check in inherit_event()
Browse files Browse the repository at this point in the history
The find_get_pmu_context() returns an ERR_PTR() on failure, we should use
IS_ERR() to check the return value.

Fixes: bd27568 ("perf: Rewrite core context handling")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20221114091833.1492575-1-cuigaosheng1@huawei.com
  • Loading branch information
gscui authored and Peter Zijlstra committed Nov 15, 2022
1 parent 3ce1cb7 commit c55bfbb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/events/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -13171,7 +13171,7 @@ inherit_event(struct perf_event *parent_event,
return child_event;

pmu_ctx = find_get_pmu_context(child_event->pmu, child_ctx, child_event);
if (!pmu_ctx) {
if (IS_ERR(pmu_ctx)) {
free_event(child_event);
return NULL;
}
Expand Down

0 comments on commit c55bfbb

Please sign in to comment.