summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/dvb-core
diff options
context:
space:
mode:
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 */