diff --git a/drivers/media/media-devnode.c b/drivers/media/media-devnode.c index 64a4b1ef3dcd..b66dc9d0766b 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; }