patch-2.2.17 linux/drivers/net/comx-hw-mixcom.c

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

diff -u --recursive --new-file v2.2.16/drivers/net/comx-hw-mixcom.c linux/drivers/net/comx-hw-mixcom.c
@@ -8,6 +8,9 @@
  *
  * Copyright (C) 1998-1999 ITConsult-Pro Co. <info@itc.hu>
  *
+ * Contributors:
+ * Arnaldo Carvalho de Melo <acme@conectiva.com.br> (0.65)
+ *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version
@@ -29,9 +32,12 @@
  *
  * Version 0.64 (99/12/01):
  *		- some more cosmetical fixes
+ *
+ * Version 0.65 (00/08/15)
+ *		- resource release on failure at MIXCOM_init
  */
 
-#define VERSION "0.64"
+#define VERSION "0.65"
 
 #include <linux/config.h>
 #include <linux/module.h>
@@ -825,8 +831,9 @@
 
 	if ((new_file = create_proc_entry(FILENAME_IO, S_IFREG | 0644, 
 	    ch->procdir)) == NULL) {
-		return -EIO;
+		goto cleanup_HW_privdata;
 	}
+
 	new_file->data = (void *)new_file;
 	new_file->read_proc = &mixcom_read_proc;
 	new_file->write_proc = &mixcom_write_proc;
@@ -835,8 +842,9 @@
 
 	if ((new_file = create_proc_entry(FILENAME_IRQ, S_IFREG | 0644, 
 	    ch->procdir)) == NULL) {
-	    	return -EIO;
+	    	goto cleanup_filename_io;
 	}
+
 	new_file->data = (void *)new_file;
 	new_file->read_proc = &mixcom_read_proc;
 	new_file->write_proc = &mixcom_write_proc;
@@ -857,8 +865,9 @@
 
 	if ((new_file = create_proc_entry(FILENAME_CHANNEL, S_IFREG | 0644, 
 	    ch->procdir)) == NULL) {
-	    	return -EIO;
+	    	goto cleanup_filename_irq;
 	}
+
 	new_file->data = (void *)new_file;
 	new_file->read_proc = &mixcom_read_proc;
 	new_file->write_proc = &mixcom_write_proc;
@@ -867,8 +876,9 @@
 
 	if ((new_file = create_proc_entry(FILENAME_TWIN, S_IFREG | 0444, 
 	    ch->procdir)) == NULL) {
-	    	return -EIO;
+	    	goto cleanup_filename_channel;
 	}
+
 	new_file->data = (void *)new_file;
 	new_file->read_proc = &mixcom_read_proc;
 	new_file->write_proc = &mixcom_write_proc;
@@ -892,6 +902,15 @@
 
 	MOD_INC_USE_COUNT;
 	return 0;
+cleanup_filename_channel:
+	remove_proc_entry(FILENAME_CHANNEL, ch->procdir);
+cleanup_filename_irq:
+	remove_proc_entry(FILENAME_IRQ, ch->procdir);
+cleanup_filename_io:
+	remove_proc_entry(FILENAME_IO, ch->procdir);
+cleanup_HW_privdata:
+	kfree(ch->HW_privdata);
+	return -EIO;
 }
 
 static int MIXCOM_exit(struct device *dev)

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