Re: [PATCH] Add support for ITE887x serial chipsets

From: Russell King
Date: Tue Mar 27 2007 - 10:17:44 EST


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:
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/