Skip to content

Commit

Permalink
[S390] call home: fix error handling in init function
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Martin Schwidefsky <[email protected]>
  • Loading branch information
heicarst authored and Martin Schwidefsky committed Oct 29, 2009
1 parent 4f8048e commit 4a0fb4c
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions drivers/s390/char/sclp_async.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,39 +170,31 @@ static int __init sclp_async_init(void)
rc = sclp_register(&sclp_async_register);
if (rc)
return rc;
callhome_sysctl_header = register_sysctl_table(kern_dir_table);
if (!callhome_sysctl_header) {
rc = -ENOMEM;
goto out_sclp;
}
if (!(sclp_async_register.sclp_receive_mask & EVTYP_ASYNC_MASK)) {
rc = -EOPNOTSUPP;
rc = -EOPNOTSUPP;
if (!(sclp_async_register.sclp_receive_mask & EVTYP_ASYNC_MASK))
goto out_sclp;
}
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);
if (!request)
goto out_sys;
sccb = (struct sclp_async_sccb *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
if (!sccb)
if (!request || !sccb)
goto out_mem;
rc = atomic_notifier_chain_register(&panic_notifier_list,
&call_home_panic_nb);
rc = atomic_notifier_chain_register(&panic_notifier_list,
&call_home_panic_nb);
if (rc)
goto out_mem;

strncpy(nodename, init_utsname()->nodename, 64);
return 0;

goto out;
out_mem:
kfree(request);
free_page((unsigned long) sccb);
out_sys:
unregister_sysctl_table(callhome_sysctl_header);
out_sclp:
sclp_unregister(&sclp_async_register);
out:
return rc;

}
module_init(sclp_async_init);

Expand Down

0 comments on commit 4a0fb4c

Please sign in to comment.