diff options
author | Josh Stone <jistone@redhat.com> | 2010-03-17 19:06:56 -0700 |
---|---|---|
committer | Josh Stone <jistone@redhat.com> | 2010-03-17 19:09:40 -0700 |
commit | 5e0ae7b6e3fe6e739b03c3ab4ef675113e38350f (patch) | |
tree | 4f379043a5f64e7b219e3ebb952a1eae14217436 /runtime | |
parent | 61cbdef4a69f73155b2d1e2934729f6cc8338511 (diff) | |
download | systemtap-steved-5e0ae7b6e3fe6e739b03c3ab4ef675113e38350f.tar.gz systemtap-steved-5e0ae7b6e3fe6e739b03c3ab4ef675113e38350f.tar.xz systemtap-steved-5e0ae7b6e3fe6e739b03c3ab4ef675113e38350f.zip |
Preserve perf initialization errors
* runtime/perf.c (_stp_perf_init): Pass through ERR_PTRs, and create our
own -ENOMEM for allocation failures.
* tapset-perfmon.cxx (perf_derived_probe_group::emit_module_init): Check
IS_ERR for registration status.
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/perf.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/runtime/perf.c b/runtime/perf.c index 7f1aaf74..053e0880 100644 --- a/runtime/perf.c +++ b/runtime/perf.c @@ -32,17 +32,20 @@ static Perf *_stp_perf_init (struct perf_event_attr *attr, perf_overflow_handler_t callback, const char *pp, void (*ph) (struct context *) ) { + long rc = -EINVAL; int cpu; Perf *pe; pe = (Perf *) _stp_kmalloc (sizeof(Perf)); if (pe == NULL) - return NULL; + return ERR_PTR(-ENOMEM); /* allocate space for the event descriptor for each cpu */ pe->pd = (perfcpu *) _stp_alloc_percpu (sizeof(perfcpu)); - if (pe->pd == NULL) + if (pe->pd == NULL) { + rc = -ENOMEM; goto exit1; + } /* initialize event on each processor */ stp_for_each_cpu(cpu) { @@ -52,6 +55,7 @@ static Perf *_stp_perf_init (struct perf_event_attr *attr, callback); if (IS_ERR(*event)) { + rc = PTR_ERR(*event); *event = NULL; goto exit2; } @@ -69,7 +73,7 @@ exit2: _stp_free_percpu(pe->pd); exit1: _stp_kfree(pe); - return NULL; + return ERR_PTR(rc); } /** Delete performance event. |