Commit 6c292278 authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

staging: comedi: amplc_pc263: check bus type in detach routine

When detaching the device in pc263_detach() mirror the bus type checks
performed by pc263_attach().  The existing tests are safe but rely on
dev->iobase being 0 when comedi_to_pci_dev(dev) is NULL.
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d2676944
...@@ -313,15 +313,18 @@ static int __devinit pc263_attach_pci(struct comedi_device *dev, ...@@ -313,15 +313,18 @@ static int __devinit pc263_attach_pci(struct comedi_device *dev,
static void pc263_detach(struct comedi_device *dev) static void pc263_detach(struct comedi_device *dev)
{ {
struct pci_dev *pcidev = comedi_to_pci_dev(dev); const struct pc263_board *thisboard = comedi_board(dev);
if (is_isa_board(thisboard)) {
if (dev->iobase)
release_region(dev->iobase, PC263_IO_SIZE);
} else if (is_pci_board(thisboard)) {
struct pci_dev *pcidev = comedi_to_pci_dev(dev);
if (pcidev) { if (pcidev) {
if (dev->iobase) if (dev->iobase)
comedi_pci_disable(pcidev); comedi_pci_disable(pcidev);
pci_dev_put(pcidev); pci_dev_put(pcidev);
} else { }
if (dev->iobase)
release_region(dev->iobase, PC263_IO_SIZE);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment