Dave noticed that we leak the PMU resource reservations when we
fail the hardware counter init.
Reported-by: David Miller <davem@davemloft.net>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: David Miller <davem@davemloft.net>
LKML-Reference: <
1252483487.7746.164.camel@twins>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
if (err)
return err;
+ counter->destroy = hw_perf_counter_destroy;
+
/*
* Generate PMC IRQs:
* (keep 'enabled' bit clear for now)
return -EOPNOTSUPP;
}
- counter->destroy = hw_perf_counter_destroy;
-
/*
* Raw event type provide the config in the event structure
*/
int err;
err = __hw_perf_counter_init(counter);
- if (err)
+ if (err) {
+ if (counter->destroy)
+ counter->destroy(counter);
return ERR_PTR(err);
+ }
return &pmu;
}