Thread (6 messages) 6 messages, 3 authors, 2007-03-27

Re: [PATCH] Add support for ITE887x serial chipsets

From: Russell King <hidden>
Date: 2007-03-27 14:17:29
Also in: lkml

On Tue, Mar 27, 2007 at 04:03:03PM +0200, Niels de Vos wrote:
+static int __devinit pci_ite887x_init(struct pci_dev *dev)
+{
...
+	if (ret > 0) {
+		dev->dev.driver_data = iobase;
+	} else {
+		/* the device has no UARTs if we get here */
+		release_region(iobase->start, ITE_887x_IOSIZE);
+	}
+
+	return ret;
+}
+
+static void __devexit pci_ite887x_exit(struct pci_dev *dev)
+{
+	struct resource *iobase = (struct resource*) dev->dev.driver_data;
+	/* free the private driver data */
+	release_region(iobase->start, ITE_887x_IOSIZE);
+	dev->dev.driver_data = NULL;
+}
+
You can't do that.  dev->dev.driver_data is used by this very driver
itself to store its own data, or alternatively the parport_serial
driver to store its private data.  Therefore, dev->dev.driver_data
will be corrupted between your _init function setting it and your
_exit function using it.

Suggest you read the iobase back from the device to release it.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help