[PATCH 2/5] media: davinci: fix return value check in vpbe_display_reqbufs().
vb2_dma_contig_init_ctx() returns ERR_PTR and never returns NULL, so IS_ERR should be used instead of a NULL check. Signed-off-by: Cyril Roelandt tipec...@gmail.com --- drivers/media/platform/davinci/vpbe_display.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c index 2bfde79..2db4eff 100644 --- a/drivers/media/platform/davinci/vpbe_display.c +++ b/drivers/media/platform/davinci/vpbe_display.c @@ -1393,7 +1393,7 @@ static int vpbe_display_reqbufs(struct file *file, void *priv, } /* Initialize videobuf queue as per the buffer type */ layer-alloc_ctx = vb2_dma_contig_init_ctx(vpbe_dev-pdev); - if (!layer-alloc_ctx) { + if (IS_ERR(layer-alloc_ctx)) { v4l2_err(vpbe_dev-v4l2_dev, Failed to get the context\n); return -EINVAL; } -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/1] 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 tipec...@gmail.com --- drivers/media/common/saa7146/saa7146_fops.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/common/saa7146/saa7146_fops.c b/drivers/media/common/saa7146/saa7146_fops.c index b3890bd..0afe98d 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) DEB_EE(file:%p\n, file); - if (mutex_lock_interruptible(vdev-lock)) - return -ERESTARTSYS; + mutex_lock(vdev-lock); if (vdev-vfl_type == VFL_TYPE_VBI) { if (dev-ext_vv_data-capabilities V4L2_CAP_VBI_CAPTURE) -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/1] media: saa7146: don't use mutex_lock_interruptible in
This is the same kind of bug as the one fixed by ddc43d6dc7df0849fe41b91460fa76145cf87b67 : mutex_lock() must be used in the device_release file operation in order for all resources to be freed, since returning -RESTARTSYS has no effect here. I stole the commit log from Sylwester Nawrocki, who fixed a few of these issues, since I could not formulate it better. --- Cyril Roelandt (1): media: saa7146: don't use mutex_lock_interruptible() in device_release(). drivers/media/common/saa7146/saa7146_fops.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] mx2_camera: use GFP_ATOMIC under spin lock.
Found using the following semantic patch: spml @@ @@ spin_lock_irqsave(...); ... when != spin_unlock_irqrestore(...); * GFP_KERNEL /spml Signed-off-by: Cyril Roelandt tipec...@gmail.com --- drivers/media/platform/soc_camera/mx2_camera.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/soc_camera/mx2_camera.c b/drivers/media/platform/soc_camera/mx2_camera.c index e575ae8..516b3a3 100644 --- a/drivers/media/platform/soc_camera/mx2_camera.c +++ b/drivers/media/platform/soc_camera/mx2_camera.c @@ -909,7 +909,7 @@ static int mx2_start_streaming(struct vb2_queue *q, unsigned int count) pcdev-discard_size = icd-user_height * bytesperline; pcdev-discard_buffer = dma_alloc_coherent(ici-v4l2_dev.dev, pcdev-discard_size, pcdev-discard_buffer_dma, - GFP_KERNEL); + GFP_ATOMIC); if (!pcdev-discard_buffer) return -ENOMEM; -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] staging/media/solo6x10/v4l2-enc.c: fix error-handling.
The return values of copy_to_user() and copy_from_user() cannot be negative. Found using the following semantich patch: spml @exists@ identifier ret; statement S; expression E; @@ ( * ret = copy_to_user(...); | * ret = copy_from_user(...); ) ... when != ret = E when != if (ret) { +... ret = E; ...+ } * if (ret 0) S /spml Signed-off-by: Cyril Roelandt tipec...@gmail.com --- drivers/staging/media/solo6x10/v4l2-enc.c |4 1 file changed, 4 insertions(+) diff --git a/drivers/staging/media/solo6x10/v4l2-enc.c b/drivers/staging/media/solo6x10/v4l2-enc.c index f8f0da9..4977e86 100644 --- a/drivers/staging/media/solo6x10/v4l2-enc.c +++ b/drivers/staging/media/solo6x10/v4l2-enc.c @@ -1619,6 +1619,8 @@ static int solo_s_ext_ctrls(struct file *file, void *priv, solo_enc-osd_text[OSD_TEXT_MAX] = '\0'; if (!err) err = solo_osd_print(solo_enc); + else + err = -EFAULT; } break; default: @@ -1654,6 +1656,8 @@ static int solo_g_ext_ctrls(struct file *file, void *priv, err = copy_to_user(ctrl-string, solo_enc-osd_text, OSD_TEXT_MAX); + if (err) + err = -EFAULT; } break; default: -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html