MOD_INC/DEC fixes
authorDavid Schleef <ds@schleef.org>
Thu, 13 Jul 2000 01:27:59 +0000 (01:27 +0000)
committerDavid Schleef <ds@schleef.org>
Thu, 13 Jul 2000 01:27:59 +0000 (01:27 +0000)
comedi/comedi_fops.c
comedi/drivers.c

index 21c5aa9f96709dc90b66e944e4f688e5a4bd0fd6..cc2abd22ecdcb11b00e6b854c6f7959e7cf5c000 100644 (file)
@@ -1440,7 +1440,7 @@ static int comedi_fop_open(struct inode *inode,struct file *file)
 
 ok:
        MOD_INC_USE_COUNT;
-       if(dev->attached){
+       if(dev->attached && dev->driver->module){
                __MOD_INC_USE_COUNT(dev->driver->module);
        }
        dev->use_count++;
@@ -1466,7 +1466,7 @@ static int comedi_close_v22(struct inode *inode,struct file *file)
        }
 
        MOD_DEC_USE_COUNT;
-       if(dev->attached){
+       if(dev->attached && dev->driver->module){
                __MOD_DEC_USE_COUNT(dev->driver->module);
        }
 
index e4618ef2b4df6a6e81d5280378a2d8cbc98cf085..dcfc58b987b2767228d97c3fb865899f627164d0 100644 (file)
@@ -123,7 +123,7 @@ attached:
        dev->attached=1;
        dev->driver=driv;
 
-       if(dev->driver->module)
+       if(driver->module)
                __MOD_INC_USE_COUNT(driv->module);
 
        return 0;