Skip to content

Commit

Permalink
perf: Fix error return code
Browse files Browse the repository at this point in the history
Fix to return -ENOMEM in the allocation error case instead of 0
(if pmu_bus_running == 1), as done elsewhere in this function.

Signed-off-by: Wei Yongjun <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Link: http://lkml.kernel.org/r/CAPgLHd8j_fWcgqe%3DKLWjpBj%2B%3Do0Pw6Z-SEq%[email protected]
[ Tweaked the error code setting placement and the changelog. ]
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
Wei Yongjun authored and Ingo Molnar committed Apr 12, 2013
1 parent 75761cc commit c481420
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions kernel/events/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -5987,6 +5987,7 @@ int perf_pmu_register(struct pmu *pmu, char *name, int type)
if (pmu->pmu_cpu_context)
goto got_cpu_context;

ret = -ENOMEM;
pmu->pmu_cpu_context = alloc_percpu(struct perf_cpu_context);
if (!pmu->pmu_cpu_context)
goto free_dev;
Expand Down

0 comments on commit c481420

Please sign in to comment.