diff options
author | Davidlohr Bueso <dave@stgolabs.net> | 2018-08-22 01:01:56 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-08-22 13:52:52 -0400 |
commit | eae04d25a713304c978d7c45dcab01b0e0811c74 (patch) | |
tree | 7b2dfd99330a00a7586a8b8368161df9457bcd96 /ipc/util.c | |
parent | dc2c8c84def6ce450c63529e08c1db100020994e (diff) |
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.
[manfred@colorfullife.com: variable name added to util.h to resolve checkpatch warning]
Link: http://lkml.kernel.org/r/20180712185241.4017-11-manfred@colorfullife.com
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Signed-off-by: Manfred Spraul <manfred@colorfullife.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Kees Cook <keescook@chromium.org>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: Michal Hocko <mhocko@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'ipc/util.c')
-rw-r--r-- | ipc/util.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/ipc/util.c b/ipc/util.c index 7c1387c9510d..a2aae8c1410d 100644 --- a/ipc/util.c +++ b/ipc/util.c | |||
@@ -88,16 +88,12 @@ struct ipc_proc_iface { | |||
88 | */ | 88 | */ |
89 | static int __init ipc_init(void) | 89 | static int __init ipc_init(void) |
90 | { | 90 | { |
91 | int err_sem, err_msg; | ||
92 | |||
93 | proc_mkdir("sysvipc", NULL); | 91 | proc_mkdir("sysvipc", NULL); |
94 | err_sem = sem_init(); | 92 | sem_init(); |
95 | WARN(err_sem, "ipc: sysv sem_init failed: %d\n", err_sem); | 93 | msg_init(); |
96 | err_msg = msg_init(); | ||
97 | WARN(err_msg, "ipc: sysv msg_init failed: %d\n", err_msg); | ||
98 | shm_init(); | 94 | shm_init(); |
99 | 95 | ||
100 | return err_msg ? err_msg : err_sem; | 96 | return 0; |
101 | } | 97 | } |
102 | device_initcall(ipc_init); | 98 | device_initcall(ipc_init); |
103 | 99 | ||
@@ -116,21 +112,17 @@ static const struct rhashtable_params ipc_kht_params = { | |||
116 | * Set up the sequence range to use for the ipc identifier range (limited | 112 | * Set up the sequence range to use for the ipc identifier range (limited |
117 | * below IPCMNI) then initialise the keys hashtable and ids idr. | 113 | * below IPCMNI) then initialise the keys hashtable and ids idr. |
118 | */ | 114 | */ |
119 | int ipc_init_ids(struct ipc_ids *ids) | 115 | void ipc_init_ids(struct ipc_ids *ids) |
120 | { | 116 | { |
121 | int err; | ||
122 | ids->in_use = 0; | 117 | ids->in_use = 0; |
123 | ids->seq = 0; | 118 | ids->seq = 0; |
124 | init_rwsem(&ids->rwsem); | 119 | init_rwsem(&ids->rwsem); |
125 | err = rhashtable_init(&ids->key_ht, &ipc_kht_params); | 120 | rhashtable_init(&ids->key_ht, &ipc_kht_params); |
126 | if (err) | ||
127 | return err; | ||
128 | idr_init(&ids->ipcs_idr); | 121 | idr_init(&ids->ipcs_idr); |
129 | ids->max_id = -1; | 122 | ids->max_id = -1; |
130 | #ifdef CONFIG_CHECKPOINT_RESTORE | 123 | #ifdef CONFIG_CHECKPOINT_RESTORE |
131 | ids->next_id = -1; | 124 | ids->next_id = -1; |
132 | #endif | 125 | #endif |
133 | return 0; | ||
134 | } | 126 | } |
135 | 127 | ||
136 | #ifdef CONFIG_PROC_FS | 128 | #ifdef CONFIG_PROC_FS |