From: Jose Alonso <alonso@estadao.com.br>

I am using a pcmcia modem (linux-2.6.3) and when I unplug the
card the kernel warns:
"kernel: Trying to free nonexistent resource <000003e8-000003ef>"

The allocation of I/O address is done in:
module serial_cs:
  simple_config:
    pcmcia_request_io  ---> allocate I/O address
    setup_serial ... serial8250_request_port ---> doesn't allocate I/O
                      (UPF_RESOURCES is not set)

The release of I/O address is done in:
module serial_cs:
  serial_remove:
    unregister_serial ... serial8250_release_port ---> release I/O
    pcmcia_release_io ---> release again the I/O

I suggest the patch below.

(rmk says "Yep, looks good.  However, with the next round of core PCMCIA
patches, I hope to eliminate the need for UPF_RESOURCES entirely.")


---

 25-akpm/drivers/serial/8250.c |    2 ++
 1 files changed, 2 insertions(+)

diff -puN drivers/serial/8250.c~8250-resource-management-fix drivers/serial/8250.c
--- 25/drivers/serial/8250.c~8250-resource-management-fix	2004-03-28 13:47:00.404411976 -0800
+++ 25-akpm/drivers/serial/8250.c	2004-03-28 13:47:00.408411368 -0800
@@ -1676,6 +1676,8 @@ static void serial8250_release_port(stru
 	struct uart_8250_port *up = (struct uart_8250_port *)port;
 	unsigned long start, offset = 0, size = 0;
 
+	if (!(up->port.flags & UPF_RESOURCES))
+		return;
 	if (up->port.type == PORT_RSA) {
 		offset = UART_RSA_BASE << up->port.regshift;
 		size = 8;

_