patch-2.3.19 linux/drivers/char/serial.c

Next file: linux/drivers/char/softdog.c
Previous file: linux/drivers/char/saa5249.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.18/linux/drivers/char/serial.c linux/drivers/char/serial.c
@@ -2006,7 +2006,7 @@
 	info->xmit_fifo_size = state->xmit_fifo_size =
 		new_serial.xmit_fifo_size;
 
-	if (state->port)
+	if (state->type != PORT_UNKNOWN && state->port)
 		release_region(state->port,8);
 	if (change_port || change_irq) {
 		/*
@@ -4082,6 +4082,7 @@
 	unsigned long flags;
 	int e1, e2;
 	int i;
+	struct async_struct *info;
 
 	/* printk("Unloading %s: version %s\n", serial_name, serial_version); */
 	save_flags(flags);
@@ -4101,6 +4102,11 @@
 	for (i = 0; i < NR_PORTS; i++) {
 		if ((rs_table[i].type != PORT_UNKNOWN) && rs_table[i].port)
 			release_region(rs_table[i].port, 8);
+ 		info = rs_table[i].info;
+ 		if (info) {
+ 			rs_table[i].info = NULL;
+ 			kfree_s(info, sizeof(struct async_struct));
+ 		}
 #if defined(ENABLE_SERIAL_PCI) && defined (CONFIG_SERIAL_PCI_MEMMAPPED)
 		if (rs_table[i].iomem_base)
 			iounmap(rs_table[i].iomem_base);

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