diff options
author | Cyril Roelandt <tipecaml@gmail.com> | 2012-12-10 21:05:28 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-12-27 14:34:28 -0500 |
commit | 21a73397c0cea688a37c532d1029fc8ecbd88fc6 (patch) | |
tree | 20f98db46eeb655daea7395842e3d83735795344 /drivers/media | |
parent | 9d7005f9875460021f28df90783771875b694a32 (diff) |
[media] media: saa7146: don't use mutex_lock_interruptible() in device_release()
Use uninterruptible mutex_lock in the release() file op to make sure all
resources are properly freed when a process is being terminated. Returning
-ERESTARTSYS has no effect for a terminating process and this may cause driver
resources not to be released.
This was found using the following semantic patch (http://coccinelle.lip6.fr/):
<spml>
@r@
identifier fops;
identifier release_func;
@@
static const struct v4l2_file_operations fops = {
.release = release_func
};
@depends on r@
identifier r.release_func;
expression E;
@@
static int release_func(...)
{
...
- if (mutex_lock_interruptible(E)) return -ERESTARTSYS;
+ mutex_lock(E);
...
}
</spml>
Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/common/saa7146/saa7146_fops.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/media/common/saa7146/saa7146_fops.c b/drivers/media/common/saa7146/saa7146_fops.c index 2652f9155c34..eda01bc68ab2 100644 --- a/drivers/media/common/saa7146/saa7146_fops.c +++ b/drivers/media/common/saa7146/saa7146_fops.c | |||
@@ -265,8 +265,7 @@ static int fops_release(struct file *file) | |||
265 | 265 | ||
266 | DEB_EE("file:%p\n", file); | 266 | DEB_EE("file:%p\n", file); |
267 | 267 | ||
268 | if (mutex_lock_interruptible(vdev->lock)) | 268 | mutex_lock(vdev->lock); |
269 | return -ERESTARTSYS; | ||
270 | 269 | ||
271 | if (vdev->vfl_type == VFL_TYPE_VBI) { | 270 | if (vdev->vfl_type == VFL_TYPE_VBI) { |
272 | if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE) | 271 | if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE) |