summaryrefslogtreecommitdiff
path: root/drivers/media/media-devnode.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/media-devnode.c')
-rw-r--r--drivers/media/media-devnode.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/media/media-devnode.c b/drivers/media/media-devnode.c
index 29409f440..b66dc9d07 100644
--- a/drivers/media/media-devnode.c
+++ b/drivers/media/media-devnode.c
@@ -197,10 +197,11 @@ static int media_release(struct inode *inode, struct file *filp)
if (mdev->fops->release)
mdev->fops->release(filp);
+ filp->private_data = NULL;
+
/* decrease the refcount unconditionally since the release()
return value is ignored. */
put_device(&mdev->dev);
- filp->private_data = NULL;
return 0;
}
@@ -267,8 +268,11 @@ int __must_check media_devnode_register(struct media_devnode *mdev,
return 0;
error:
+ mutex_lock(&media_devnode_lock);
cdev_del(&mdev->cdev);
clear_bit(mdev->minor, media_devnode_nums);
+ mutex_unlock(&media_devnode_lock);
+
return ret;
}