From: David Schleef Date: Thu, 13 Jul 2000 01:27:59 +0000 (+0000) Subject: MOD_INC/DEC fixes X-Git-Tag: r0_7_46~6 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=bb300029b5df1102883013695866eff8e9476576;p=comedi.git MOD_INC/DEC fixes --- diff --git a/comedi/comedi_fops.c b/comedi/comedi_fops.c index 21c5aa9f..cc2abd22 100644 --- a/comedi/comedi_fops.c +++ b/comedi/comedi_fops.c @@ -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); } diff --git a/comedi/drivers.c b/comedi/drivers.c index e4618ef2..dcfc58b9 100644 --- a/comedi/drivers.c +++ b/comedi/drivers.c @@ -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;