Skip to content

Commit

Permalink
perf/core: Remove some dead code
Browse files Browse the repository at this point in the history
perf_init_event() can't return NULL.  If it did, the error handling is
incomplete and we would crash.  I have removed this confusing dead code.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Link: http://lkml.kernel.org/r/20170522090348.5g7yyld5en3yeky4@mwanda
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Dan Carpenter authored and Ingo Molnar committed May 23, 2017
1 parent 6089327 commit 85c617a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions kernel/events/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -9172,7 +9172,7 @@ static int perf_try_init_event(struct pmu *pmu, struct perf_event *event)

static struct pmu *perf_init_event(struct perf_event *event)
{
struct pmu *pmu = NULL;
struct pmu *pmu;
int idx;
int ret;

Expand Down Expand Up @@ -9456,9 +9456,7 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu,
}

pmu = perf_init_event(event);
if (!pmu)
goto err_ns;
else if (IS_ERR(pmu)) {
if (IS_ERR(pmu)) {
err = PTR_ERR(pmu);
goto err_ns;
}
Expand Down

0 comments on commit 85c617a

Please sign in to comment.