staging: comedi: dyna_pci10xx: fix detach
authorH Hartley Sweeten <hartleys@visionengravers.com>
Thu, 19 Jul 2012 02:01:34 +0000 (19:01 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Jul 2012 23:51:38 +0000 (16:51 -0700)
The detach for this driver is missing the check to make sure
that the pci device is enabled before disabling it.

It's also missing the pci_dev_put().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/dyna_pci10xx.c

index 6821f87..064be9a 100644 (file)
@@ -346,7 +346,9 @@ static void dyna_pci10xx_detach(struct comedi_device *dev)
        if (devpriv)
                mutex_destroy(&devpriv->mutex);
        if (pcidev) {
-               comedi_pci_disable(pcidev);
+               if (dev->iobase)
+                       comedi_pci_disable(pcidev);
+               pci_dev_put(pcidev);
        }
 }