summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/dvb-core
diff options
context:
space:
mode:
authorAndrew de Quincy <devnull@localhost>2004-11-13 19:24:49 +0000
committerAndrew de Quincy <devnull@localhost>2004-11-13 19:24:49 +0000
commitee62618e61e336e3f62e9b07d95650d46e87eadb (patch)
tree3a3056f96563579f5d494404467ecef79f3776ef /linux/drivers/media/dvb/dvb-core
parentd3f8f1e3c54e43c5eb830f30fe37a251196d4d90 (diff)
downloadmediapointer-dvb-s2-ee62618e61e336e3f62e9b07d95650d46e87eadb.tar.gz
mediapointer-dvb-s2-ee62618e61e336e3f62e9b07d95650d46e87eadb.tar.bz2
Fix module usage count problem
Diffstat (limited to 'linux/drivers/media/dvb/dvb-core')
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c10
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.h3
2 files changed, 10 insertions, 3 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
index 7fe4c100d..1be92f9e1 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
+++ b/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
@@ -1531,6 +1531,9 @@ static int dvb_ca_en50221_io_open(struct inode *inode, struct file *file)
dprintk("%s\n", __FUNCTION__);
+ if (!try_module_get(ca->pub->owner))
+ return -EIO;
+
err = dvb_generic_open(inode, file);
if (err < 0)
return err;
@@ -1566,7 +1569,7 @@ static int dvb_ca_en50221_io_release(struct inode *inode, struct file *file)
{
struct dvb_device *dvbdev = (struct dvb_device *) file->private_data;
struct dvb_ca_private *ca = (struct dvb_ca_private *) dvbdev->priv;
- int err;
+ int err = 0;
dprintk("%s\n", __FUNCTION__);
@@ -1575,8 +1578,9 @@ static int dvb_ca_en50221_io_release(struct inode *inode, struct file *file)
dvb_ca_en50221_thread_update_delay(ca);
err = dvb_generic_release(inode, file);
- if (err < 0)
- return err;
+
+ module_put(ca->pub->owner);
+
return 0;
}
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.h b/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.h
index dcb4e68b4..8467e63dd 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.h
+++ b/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.h
@@ -42,6 +42,9 @@
/* Structure describing a CA interface */
struct dvb_ca_en50221 {
+ /* the module owning this structure */
+ struct module* owner;
+
/* NOTE: the read_*, write_* and poll_slot_status functions must use locks as
* they may be called from several threads at once */