[S390] call home: fix error handling in init function

Fix missing unregister_sysctl_table in case the SCLP doesn't provide
the requested feature. Also simplify the whole error handling while
at it.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
Heiko Carstens 2009-10-29 15:04:10 +01:00 коммит произвёл Martin Schwidefsky
Родитель 4f8048ee73
Коммит 4a0fb4c445
1 изменённых файлов: 10 добавлений и 18 удалений

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

@ -170,39 +170,31 @@ static int __init sclp_async_init(void)
rc = sclp_register(&sclp_async_register); rc = sclp_register(&sclp_async_register);
if (rc) if (rc)
return rc; return rc;
callhome_sysctl_header = register_sysctl_table(kern_dir_table); rc = -EOPNOTSUPP;
if (!callhome_sysctl_header) { if (!(sclp_async_register.sclp_receive_mask & EVTYP_ASYNC_MASK))
rc = -ENOMEM;
goto out_sclp; goto out_sclp;
}
if (!(sclp_async_register.sclp_receive_mask & EVTYP_ASYNC_MASK)) {
rc = -EOPNOTSUPP;
goto out_sclp;
}
rc = -ENOMEM; rc = -ENOMEM;
callhome_sysctl_header = register_sysctl_table(kern_dir_table);
if (!callhome_sysctl_header)
goto out_sclp;
request = kzalloc(sizeof(struct sclp_req), GFP_KERNEL); request = kzalloc(sizeof(struct sclp_req), GFP_KERNEL);
if (!request)
goto out_sys;
sccb = (struct sclp_async_sccb *) get_zeroed_page(GFP_KERNEL | GFP_DMA); sccb = (struct sclp_async_sccb *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
if (!sccb) if (!request || !sccb)
goto out_mem; goto out_mem;
rc = atomic_notifier_chain_register(&panic_notifier_list, rc = atomic_notifier_chain_register(&panic_notifier_list,
&call_home_panic_nb); &call_home_panic_nb);
if (rc) if (rc)
goto out_mem; goto out_mem;
strncpy(nodename, init_utsname()->nodename, 64); strncpy(nodename, init_utsname()->nodename, 64);
return 0; goto out;
out_mem: out_mem:
kfree(request); kfree(request);
free_page((unsigned long) sccb); free_page((unsigned long) sccb);
out_sys:
unregister_sysctl_table(callhome_sysctl_header); unregister_sysctl_table(callhome_sysctl_header);
out_sclp: out_sclp:
sclp_unregister(&sclp_async_register); sclp_unregister(&sclp_async_register);
out:
return rc; return rc;
} }
module_init(sclp_async_init); module_init(sclp_async_init);