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

From: Vegard Nossum
Date: Sat Nov 22 2008 - 06:12:11 EST


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/