From 5cf829fbaedba1a1e46dd8db53ed2e9da85d2044 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Thu, 8 Aug 2002 00:37:17 +0000 Subject: [PATCH] only release regions if we requested them. --- comedi/drivers/mite.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/comedi/drivers/mite.c b/comedi/drivers/mite.c index 103a7d90..7deaef5d 100644 --- a/comedi/drivers/mite.c +++ b/comedi/drivers/mite.c @@ -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; } -- 2.26.2