patch-2.4.0-test9 linux/drivers/net/wan/comx-proto-fr.c

Next file: linux/drivers/net/wan/comx-proto-ppp.c
Previous file: linux/drivers/net/wan/comx-hw-mixcom.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/wan/comx-proto-fr.c linux/drivers/net/wan/comx-proto-fr.c
@@ -6,6 +6,9 @@
  * Maintainer: Gergely Madarasz <gorgo@itc.hu>
  *
  * Copyright (C) 1998-1999 ITConsult-Pro Co. <info@itc.hu>
+ * 
+ * Contributors:
+ * Arnaldo Carvalho de Melo <acme@conectiva.com.br> (0.73)
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -25,9 +28,13 @@
  * Version 0.72 (99/07/09):
  *		- handle slave tbusy with master tbusy (should be fixed)
  *		- fix the keepalive timer addition/deletion
+ *
+ * Version 0.73 (00/08/15)
+ * 		- resource release on failure at fr_master_init and
+ *		  fr_slave_init 		  
  */
 
-#define VERSION "0.72"
+#define VERSION "0.73"
 
 #include <linux/module.h>
 #include <linux/version.h>
@@ -793,7 +800,7 @@
 
 	if ((new_file = create_proc_entry(FILENAME_DLCI, S_IFREG | 0644, 
 	    ch->procdir)) == NULL) {
-		return -ENOMEM;
+		goto cleanup_LINE_privdata;
 	}
 	new_file->data = (void *)new_file;
 	new_file->read_proc = &fr_read_proc;
@@ -803,7 +810,7 @@
 
 	if ((new_file = create_proc_entry(FILENAME_KEEPALIVE, S_IFREG | 0644, 
 	    ch->procdir)) == NULL) {
-		return -ENOMEM;
+		goto cleanup_filename_dlci;
 	}
 	new_file->data = (void *)new_file;
 	new_file->read_proc = &fr_read_proc;
@@ -815,6 +822,11 @@
 
 	MOD_INC_USE_COUNT;
 	return 0;
+cleanup_filename_dlci:
+	 remove_proc_entry(FILENAME_DLCI, ch->procdir);
+cleanup_LINE_privdata:
+	kfree(fr);
+	return -EIO;
 }
 
 static int fr_slave_init(struct net_device *dev)
@@ -847,7 +859,7 @@
 
 	if ((new_file = create_proc_entry(FILENAME_DLCI, S_IFREG | 0644, 
 	    ch->procdir)) == NULL) {
-		return -ENOMEM;
+		goto cleanup_LINE_privdata;
 	}
 	
 	new_file->data = (void *)new_file;
@@ -858,7 +870,7 @@
 
 	if ((new_file = create_proc_entry(FILENAME_MASTER, S_IFREG | 0644, 
 	    ch->procdir)) == NULL) {
-		return -EIO;
+		goto cleanup_filename_dlci;
 	}
 	new_file->data = (void *)new_file;
 	new_file->read_proc = &fr_read_proc;
@@ -867,6 +879,11 @@
 	new_file->nlink = 1;
 	MOD_INC_USE_COUNT;
 	return 0;
+cleanup_filename_dlci:
+         remove_proc_entry(FILENAME_DLCI, ch->procdir);
+cleanup_LINE_privdata:
+	kfree(fr);
+	return -EIO;
 }
 
 static int dlci_open(struct net_device *dev)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)