only release regions if we requested them.
authorFrank Mori Hess <fmhess@speakeasy.net>
Thu, 8 Aug 2002 00:37:17 +0000 (00:37 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Thu, 8 Aug 2002 00:37:17 +0000 (00:37 +0000)
comedi/drivers/mite.c

index 103a7d90400875c1ba083b1fe6c1d8b813fe2eba..7deaef5d6f258ee205a53a3173a086f905ecf1c5 100644 (file)
@@ -103,15 +103,15 @@ int mite_setup(struct mite_struct *mite)
        unsigned long                   offset, start, length;
        u32                             addr;
 
-       if( pci_request_regions( mite->pcidev, "mite" ) ) {
-               printk("failed to request mite io regions\n");
-               return -EIO;
-       }; 
        if(pci_enable_device(mite->pcidev)){
                printk("error enabling mite\n");
                return -EIO;
        }
        pci_set_master(mite->pcidev);
+       if( pci_request_regions( mite->pcidev, "mite" ) ) {
+               printk("failed to request mite io regions\n");
+               return -EIO;
+       }; 
 
        addr = pci_resource_start(mite->pcidev, 0);
        mite->mite_phys_addr = addr;
@@ -170,7 +170,8 @@ void mite_unsetup(struct mite_struct *mite)
                iounmap(mite->daq_io_addr);
                mite->daq_io_addr=NULL;
        }
-       pci_release_regions( mite->pcidev );
+       if( mite->used )
+               pci_release_regions( mite->pcidev );
 
        mite->used = 0;
 }