diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2009-10-29 10:04:10 -0400 |
---|---|---|
committer | Martin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com> | 2009-10-29 10:05:12 -0400 |
commit | 4a0fb4c44573759f878fc65f6ddbd46080748f8b (patch) | |
tree | 4fbd49410c12f2643dd60586faf9a7ce0cb74be9 /drivers/s390 | |
parent | 4f8048ee734dab7c463574797b820c0c68c80791 (diff) |
[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>
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/char/sclp_async.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/drivers/s390/char/sclp_async.c b/drivers/s390/char/sclp_async.c index bf4a9f455d8e..3c20aa131180 100644 --- a/drivers/s390/char/sclp_async.c +++ b/drivers/s390/char/sclp_async.c | |||
@@ -170,39 +170,31 @@ static int __init sclp_async_init(void) | |||
170 | rc = sclp_register(&sclp_async_register); | 170 | rc = sclp_register(&sclp_async_register); |
171 | if (rc) | 171 | if (rc) |
172 | return rc; | 172 | return rc; |
173 | callhome_sysctl_header = register_sysctl_table(kern_dir_table); | 173 | rc = -EOPNOTSUPP; |
174 | if (!callhome_sysctl_header) { | 174 | if (!(sclp_async_register.sclp_receive_mask & EVTYP_ASYNC_MASK)) |
175 | rc = -ENOMEM; | ||
176 | goto out_sclp; | ||
177 | } | ||
178 | if (!(sclp_async_register.sclp_receive_mask & EVTYP_ASYNC_MASK)) { | ||
179 | rc = -EOPNOTSUPP; | ||
180 | goto out_sclp; | 175 | goto out_sclp; |
181 | } | ||
182 | rc = -ENOMEM; | 176 | rc = -ENOMEM; |
177 | callhome_sysctl_header = register_sysctl_table(kern_dir_table); | ||
178 | if (!callhome_sysctl_header) | ||
179 | goto out_sclp; | ||
183 | request = kzalloc(sizeof(struct sclp_req), GFP_KERNEL); | 180 | request = kzalloc(sizeof(struct sclp_req), GFP_KERNEL); |
184 | if (!request) | ||
185 | goto out_sys; | ||
186 | sccb = (struct sclp_async_sccb *) get_zeroed_page(GFP_KERNEL | GFP_DMA); | 181 | sccb = (struct sclp_async_sccb *) get_zeroed_page(GFP_KERNEL | GFP_DMA); |
187 | if (!sccb) | 182 | if (!request || !sccb) |
188 | goto out_mem; | 183 | goto out_mem; |
189 | rc = atomic_notifier_chain_register(&panic_notifier_list, | 184 | rc = atomic_notifier_chain_register(&panic_notifier_list, |
190 | &call_home_panic_nb); | 185 | &call_home_panic_nb); |
191 | if (rc) | 186 | if (rc) |
192 | goto out_mem; | 187 | goto out_mem; |
193 | |||
194 | strncpy(nodename, init_utsname()->nodename, 64); | 188 | strncpy(nodename, init_utsname()->nodename, 64); |
195 | return 0; | 189 | goto out; |
196 | |||
197 | out_mem: | 190 | out_mem: |
198 | kfree(request); | 191 | kfree(request); |
199 | free_page((unsigned long) sccb); | 192 | free_page((unsigned long) sccb); |
200 | out_sys: | ||
201 | unregister_sysctl_table(callhome_sysctl_header); | 193 | unregister_sysctl_table(callhome_sysctl_header); |
202 | out_sclp: | 194 | out_sclp: |
203 | sclp_unregister(&sclp_async_register); | 195 | sclp_unregister(&sclp_async_register); |
196 | out: | ||
204 | return rc; | 197 | return rc; |
205 | |||
206 | } | 198 | } |
207 | module_init(sclp_async_init); | 199 | module_init(sclp_async_init); |
208 | 200 | ||