When detaching the device in pc236_detach() mirror the bus type checks performed by pc236_attach(). The existing tests are safe but rely on dev->iobase being 0 when comedi_to_pci_dev(dev) is NULL. Signed-off-by: Ian Abbott <abbotti@xxxxxxxxx> --- drivers/staging/comedi/drivers/amplc_pc236.c | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c index 3d7b001..5fa04f9 100644 --- a/drivers/staging/comedi/drivers/amplc_pc236.c +++ b/drivers/staging/comedi/drivers/amplc_pc236.c @@ -572,8 +572,8 @@ static int __devinit pc236_attach_pci(struct comedi_device *dev, static void pc236_detach(struct comedi_device *dev) { + const struct pc236_board *thisboard = comedi_board(dev); struct pc236_private *devpriv = dev->private; - struct pci_dev *pcidev = comedi_to_pci_dev(dev); if (devpriv) pc236_intr_disable(dev); @@ -581,13 +581,16 @@ static void pc236_detach(struct comedi_device *dev) free_irq(dev->irq, dev); if (dev->subdevices) subdev_8255_cleanup(dev, dev->subdevices + 0); - if (pcidev) { - if (dev->iobase) - comedi_pci_disable(pcidev); - pci_dev_put(pcidev); - } else { + if (IS_ISA_BOARD(thisboard)) { if (dev->iobase) release_region(dev->iobase, PC236_IO_SIZE); + } else if (IS_PCI_BOARD(thisboard)) { + struct pci_dev *pcidev = comedi_to_pci_dev(dev); + if (pcidev) { + if (dev->iobase) + comedi_pci_disable(pcidev); + pci_dev_put(pcidev); + } } } -- 1.7.8.6 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel