<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
From: Jose Alonso &lt;alonso@estadao.com.br&gt;

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 &lt;000003e8-000003ef&gt;"

The allocation of I/O address is done in:
module serial_cs:
  simple_config:
    pcmcia_request_io  ---&gt; allocate I/O address
    setup_serial ... serial8250_request_port ---&gt; 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 ---&gt; release I/O
    pcmcia_release_io ---&gt; 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-&gt;port.flags &amp; UPF_RESOURCES))
+		return;
 	if (up-&gt;port.type == PORT_RSA) {
 		offset = UART_RSA_BASE &lt;&lt; up-&gt;port.regshift;
 		size = 8;

_
</pre></body></html>