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: Thomas Richter <tmricht@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
Thomas Richter 2018-10-15 14:39:29 +01:00 коммит произвёл Martin Schwidefsky
Родитель b5130dc222
Коммит ec0c0bb489
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -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)
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;
} }