summaryrefslogtreecommitdiff
path: root/xpp
diff options
context:
space:
mode:
authortzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-12-18 14:03:26 +0000
committertzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-12-18 14:03:26 +0000
commitf302d5cc5daa3f105d904ac56ca7deec83365b17 (patch)
tree971648fbb47e088b55566c386ebee0b2881a4d39 /xpp
parentfd1f7df9b4fae2e319e11043e6b5dfed4b12d621 (diff)
r1727@boole: tzafrir | 2006-12-18 15:59:13 +0200
r1722@boole: tzafrir | 2006-12-18 15:50:36 +0200 xpp_zap.c: Better error hanlding during module init. orig r2948: oron | 2006-12-17 18:54:00 +0200 git-svn-id: http://svn.digium.com/svn/zaptel/trunk@1731 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp')
-rw-r--r--xpp/xpp_zap.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/xpp/xpp_zap.c b/xpp/xpp_zap.c
index f8f50f9..1d567ca 100644
--- a/xpp/xpp_zap.c
+++ b/xpp/xpp_zap.c
@@ -1445,8 +1445,8 @@ static void do_cleanup(void)
int __init xpp_zap_init(void)
{
- int ret;
- struct proc_dir_entry *ent;
+ int ret = 0;
+ struct proc_dir_entry *ent;
INFO("%s revision %s MAX_XPDS=%d (%d*%d)\n", THIS_MODULE->name, ZAPTEL_VERSION,
MAX_XPDS, MAX_UNIT, MAX_SUBUNIT);
@@ -1468,14 +1468,14 @@ int __init xpp_zap_init(void)
#ifdef CONFIG_PROC_FS
xpp_proc_toplevel = proc_mkdir(PROC_DIR, NULL);
if(!xpp_proc_toplevel) {
- do_cleanup();
- return -EIO;
+ ret = -EIO;
+ goto err;
}
ent = create_proc_entry(PROC_SYNC, 0644, xpp_proc_toplevel);
if(!ent) {
- do_cleanup();
- return -EFAULT;
+ ret = -EFAULT;
+ goto err;
}
ent->read_proc = proc_sync_read;
ent->write_proc = proc_sync_write;
@@ -1484,14 +1484,16 @@ int __init xpp_zap_init(void)
ret = xbus_core_init();
if(ret) {
ERR("xbus_core_init failed (%d)\n", ret);
- do_cleanup();
- return ret;
+ goto err;
}
/* Only timer init. We add it only *after* zt_register */
init_timer(&xpp_timer);
sync_master_is(NULL); /* Internal ticking */
return 0;
+err:
+ do_cleanup();
+ return ret;
}
void __exit xpp_zap_cleanup(void)