Re: [PATCH] bttv: don't compare list_head's .next with NULL

From: Brian Phelps
Date: Mon Nov 24 2008 - 12:13:24 EST


This patch seems to cause a select timeout to occur with v4l2's
example capture.c file

On Sat, Nov 22, 2008 at 6:20 AM, Vegard Nossum <vegard.nossum@xxxxxxxxx> wrote:
> Hi Brian,
>
> Can you see if this patch helps your problem?
>
>
> Vegard
>
>
> From 84396b14b9059de4a697df4ea4e036a22513436e Mon Sep 17 00:00:00 2001
> From: Vegard Nossum <vegard.nossum@xxxxxxxxx>
> Date: Sat, 22 Nov 2008 12:12:11 +0100
> Subject: [PATCH] bttv: don't compare list_head's .next with NULL
>
> The list implementation doesn't store NULLs in .next/.prev, but
> uses poison values (for-sure invalid pointers). I assume that this
> code wanted to test whether an entry was the last in a list.
>
> This function is only ever called for the video capture list, so
> we know which list to check (it could have been vcapture as well).
>
> Patch is untested!
>
> Signed-off-by: Vegard Nossum <vegard.nossum@xxxxxxxxx>
> ---
> drivers/media/video/bt8xx/bttv-risc.c | 10 +++++-----
> 1 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/media/video/bt8xx/bttv-risc.c b/drivers/media/video/bt8xx/bttv-risc.c
> index 5b1b8e4..7a54c99 100644
> --- a/drivers/media/video/bt8xx/bttv-risc.c
> +++ b/drivers/media/video/bt8xx/bttv-risc.c
> @@ -649,14 +649,14 @@ bttv_buffer_activate_video(struct bttv *btv,
> if (NULL != set->top && NULL != set->bottom) {
> if (set->top == set->bottom) {
> set->top->vb.state = VIDEOBUF_ACTIVE;
> - if (set->top->vb.queue.next)
> + if (list_is_last(&set->top->vb.queue, &btv->capture))
> list_del(&set->top->vb.queue);
> } else {
> set->top->vb.state = VIDEOBUF_ACTIVE;
> set->bottom->vb.state = VIDEOBUF_ACTIVE;
> - if (set->top->vb.queue.next)
> + if (list_is_last(&set->top->vb.queue, &btv->capture))
> list_del(&set->top->vb.queue);
> - if (set->bottom->vb.queue.next)
> + if (list_is_last(&set->bottom->vb.queue, &btv->capture))
> list_del(&set->bottom->vb.queue);
> }
> bttv_apply_geo(btv, &set->top->geo, 1);
> @@ -671,7 +671,7 @@ bttv_buffer_activate_video(struct bttv *btv,
> ~0x0f, BT848_COLOR_CTL);
> } else if (NULL != set->top) {
> set->top->vb.state = VIDEOBUF_ACTIVE;
> - if (set->top->vb.queue.next)
> + if (list_is_last(&set->top->vb.queue, &btv->capture))
> list_del(&set->top->vb.queue);
> bttv_apply_geo(btv, &set->top->geo,1);
> bttv_apply_geo(btv, &set->top->geo,0);
> @@ -682,7 +682,7 @@ bttv_buffer_activate_video(struct bttv *btv,
> btaor(set->top->btswap & 0x0f, ~0x0f, BT848_COLOR_CTL);
> } else if (NULL != set->bottom) {
> set->bottom->vb.state = VIDEOBUF_ACTIVE;
> - if (set->bottom->vb.queue.next)
> + if (list_is_last(&set->bottom->vb.queue, &btv->capture))
> list_del(&set->bottom->vb.queue);
> bttv_apply_geo(btv, &set->bottom->geo,1);
> bttv_apply_geo(btv, &set->bottom->geo,0);
> --
> 1.5.6.5
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/