Skip to contentSkip to conversation

: 8250.c don't iounmap() when no UPF_IOREMAP

PATCH New David Kimdon 1 participant 1 message Jun 21, 2004 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : 8250.c don't iounmap() when no UPF_IOREMAP

Hi,

I have a PCI serial device, using 2.6.6 I get :

__iounmap: bad address fbc79200
__iounmap: bad address fbc79400
__iounmap: bad address fbc79600
. . . .

When the driver is unloaded. Something like the included patch is, I believe, necessary. I don't see any drivers that actually use the UPF_IOREMAP flag, so it isn't completely clear to me how it should be used.

-David

* drivers/serial/8250.c (serial8250_request_std_resource) : Only request a resource if UPF_IOREMAP is set.
(serial8250_release_port) : If UPF_IOREMAP is not set then we didn't do an ioremap(). In that case we shouldn't do iounmap() or release_mem_region().

drivers/serial/8250.c +2 -2
Index: linux/drivers/serial/8250.c
===================================================================
@@ -1634,7 +1634,7 @@ serial8250_request_std_resource(struct u
 
 	switch (up->port.iotype) {
 	case UPIO_MEM:
-		if (up->port.mapbase) {
+		if (up->port.mapbase && up->port.flags & UPF_IOREMAP) {
 			*res = request_mem_region(up->port.mapbase, size, "serial");
 			if (!*res)
 				ret = -EBUSY;
@@ -1698,7 +1698,7 @@ static void serial8250_release_port(stru
 
 	switch (up->port.iotype) {
 	case UPIO_MEM:
-		if (up->port.mapbase) {
+		if (up->port.mapbase && up->port.flags & UPF_IOREMAP) {
 			/*
 			 * Unmap the area.
 			 */