summaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorIan Abbott <abbotti@mev.co.uk>2012-08-14 16:31:29 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-08-14 16:46:33 -0700
commitb7518888afc14e3d1e988837fef4471cd2b3c820 (patch)
treea800a9d8462329e4e52aeabbc19b9cd41247e77a /drivers/staging
parentd99ff52ef1da75053de9e42a620930f74615f8ea (diff)
downloadop-kernel-dev-b7518888afc14e3d1e988837fef4471cd2b3c820.zip
op-kernel-dev-b7518888afc14e3d1e988837fef4471cd2b3c820.tar.gz
staging: comedi: amplc_dio200: check bus type in detach routine
When detaching the device in dio200_detach() mirror the bus type checks performed by dio200_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@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/comedi/drivers/amplc_dio200.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c
index 0905e40..7a61831 100644
--- a/drivers/staging/comedi/drivers/amplc_dio200.c
+++ b/drivers/staging/comedi/drivers/amplc_dio200.c
@@ -1417,7 +1417,6 @@ static int __devinit dio200_attach_pci(struct comedi_device *dev,
static void dio200_detach(struct comedi_device *dev)
{
const struct dio200_board *thisboard = comedi_board(dev);
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
const struct dio200_layout_struct *layout;
unsigned n;
@@ -1442,13 +1441,16 @@ static void dio200_detach(struct comedi_device *dev)
}
}
}
- 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, DIO200_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);
+ }
}
}
OpenPOWER on IntegriCloud