[svn-commits] tzafrir: branch 1.2 r1722 - /branches/1.2/xpp/xpp_zap.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Mon Dec 18 06:50:36 MST 2006


Author: tzafrir
Date: Mon Dec 18 07:50:36 2006
New Revision: 1722

URL: http://svn.digium.com/view/zaptel?view=rev&rev=1722
Log:
xpp_zap.c: Better error hanlding during module init.

orig r2948:  oron | 2006-12-17 18:54:00 +0200

Modified:
    branches/1.2/xpp/xpp_zap.c

Modified: branches/1.2/xpp/xpp_zap.c
URL: http://svn.digium.com/view/zaptel/branches/1.2/xpp/xpp_zap.c?view=diff&rev=1722&r1=1721&r2=1722
==============================================================================
--- branches/1.2/xpp/xpp_zap.c (original)
+++ branches/1.2/xpp/xpp_zap.c Mon Dec 18 07:50:36 2006
@@ -1445,8 +1445,8 @@
 
 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 @@
 #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 @@
 	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)



More information about the svn-commits mailing list