From bb300029b5df1102883013695866eff8e9476576 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Thu, 13 Jul 2000 01:27:59 +0000 Subject: [PATCH] MOD_INC/DEC fixes --- comedi/comedi_fops.c | 4 ++-- comedi/drivers.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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; -- 2.26.2