mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 12:10:52 -04:00
ipc: simplify ipc initialization
Now that we know that rhashtable_init() will not fail, we can get rid of a lot of the unnecessary cleanup paths when the call errored out. [[email protected]: variable name added to util.h to resolve checkpatch warning] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Davidlohr Bueso <[email protected]> Signed-off-by: Manfred Spraul <[email protected]> Cc: Dmitry Vyukov <[email protected]> Cc: Herbert Xu <[email protected]> Cc: Kees Cook <[email protected]> Cc: Michael Kerrisk <[email protected]> Cc: Michal Hocko <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
dc2c8c84de
commit
eae04d25a7
6 changed files with 30 additions and 54 deletions
18
ipc/util.c
18
ipc/util.c
|
|
@ -88,16 +88,12 @@ struct ipc_proc_iface {
|
|||
*/
|
||||
static int __init ipc_init(void)
|
||||
{
|
||||
int err_sem, err_msg;
|
||||
|
||||
proc_mkdir("sysvipc", NULL);
|
||||
err_sem = sem_init();
|
||||
WARN(err_sem, "ipc: sysv sem_init failed: %d\n", err_sem);
|
||||
err_msg = msg_init();
|
||||
WARN(err_msg, "ipc: sysv msg_init failed: %d\n", err_msg);
|
||||
sem_init();
|
||||
msg_init();
|
||||
shm_init();
|
||||
|
||||
return err_msg ? err_msg : err_sem;
|
||||
return 0;
|
||||
}
|
||||
device_initcall(ipc_init);
|
||||
|
||||
|
|
@ -116,21 +112,17 @@ static const struct rhashtable_params ipc_kht_params = {
|
|||
* Set up the sequence range to use for the ipc identifier range (limited
|
||||
* below IPCMNI) then initialise the keys hashtable and ids idr.
|
||||
*/
|
||||
int ipc_init_ids(struct ipc_ids *ids)
|
||||
void ipc_init_ids(struct ipc_ids *ids)
|
||||
{
|
||||
int err;
|
||||
ids->in_use = 0;
|
||||
ids->seq = 0;
|
||||
init_rwsem(&ids->rwsem);
|
||||
err = rhashtable_init(&ids->key_ht, &ipc_kht_params);
|
||||
if (err)
|
||||
return err;
|
||||
rhashtable_init(&ids->key_ht, &ipc_kht_params);
|
||||
idr_init(&ids->ipcs_idr);
|
||||
ids->max_id = -1;
|
||||
#ifdef CONFIG_CHECKPOINT_RESTORE
|
||||
ids->next_id = -1;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
|
|
|
|||
Loading…
Reference in a new issue