Commit ec0c0bb4 authored by Thomas Richter's avatar Thomas Richter Committed by Martin Schwidefsky

s390/perf: Return error when debug_register fails

Return an error when the function debug_register() fails allocating
the debug handle.
Also remove the registered debug handle when the initialization fails
later on.
Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
Reviewed-by: default avatarHendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent b5130dc2
...@@ -2045,14 +2045,17 @@ static int __init init_cpum_sampling_pmu(void) ...@@ -2045,14 +2045,17 @@ static int __init init_cpum_sampling_pmu(void)
} }
sfdbg = debug_register(KMSG_COMPONENT, 2, 1, 80); sfdbg = debug_register(KMSG_COMPONENT, 2, 1, 80);
if (!sfdbg) if (!sfdbg) {
pr_err("Registering for s390dbf failed\n"); pr_err("Registering for s390dbf failed\n");
return -ENOMEM;
}
debug_register_view(sfdbg, &debug_sprintf_view); debug_register_view(sfdbg, &debug_sprintf_view);
err = register_external_irq(EXT_IRQ_MEASURE_ALERT, err = register_external_irq(EXT_IRQ_MEASURE_ALERT,
cpumf_measurement_alert); cpumf_measurement_alert);
if (err) { if (err) {
pr_cpumsf_err(RS_INIT_FAILURE_ALRT); pr_cpumsf_err(RS_INIT_FAILURE_ALRT);
debug_unregister(sfdbg);
goto out; goto out;
} }
...@@ -2061,6 +2064,7 @@ static int __init init_cpum_sampling_pmu(void) ...@@ -2061,6 +2064,7 @@ static int __init init_cpum_sampling_pmu(void)
pr_cpumsf_err(RS_INIT_FAILURE_PERF); pr_cpumsf_err(RS_INIT_FAILURE_PERF);
unregister_external_irq(EXT_IRQ_MEASURE_ALERT, unregister_external_irq(EXT_IRQ_MEASURE_ALERT,
cpumf_measurement_alert); cpumf_measurement_alert);
debug_unregister(sfdbg);
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment