summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Osterlund <petero2@telia.com>2004-09-25 19:49:53 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-09-25 19:49:53 -0700
commitbeb0e5c2e16058dccf3f78f5cce0e54aa79dd20f (patch)
tree199e7489d3f49596827b533433f16210058a3188
parent9c083ebee5a19c07e5b7c7778ed9cc572cbbc848 (diff)
[PATCH] bttv: fix DMA setup bug in latest update
This fixes the bug that made the card DMA lots of data to random memory locations, causing lockups and instant reboots. The problem was that the yoffset variable got modified inside the loop, but the logic in the switch statement was meant to work on the initial value of the yoffset variable. (Bug fix extracted from http://marc.theaimsgroup.com/?l=linux-kernel&m=109532814823565&w=2) Signed-off-by: Peter Osterlund <petero2@telia.com> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/media/video/bttv-risc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/media/video/bttv-risc.c b/drivers/media/video/bttv-risc.c
index 33bf3a490ebe..3731d2c9a26c 100644
--- a/drivers/media/video/bttv-risc.c
+++ b/drivers/media/video/bttv-risc.c
@@ -125,6 +125,7 @@ bttv_risc_planar(struct bttv *btv, struct btcx_riscmem *risc,
struct scatterlist *ysg;
struct scatterlist *usg;
struct scatterlist *vsg;
+ int topfield = (0 == yoffset);
int rc;
/* estimate risc mem: worst case is one write per page border +
@@ -153,13 +154,13 @@ bttv_risc_planar(struct bttv *btv, struct btcx_riscmem *risc,
chroma = 1;
break;
case 1:
- if (!yoffset)
+ if (topfield)
chroma = (line & 1) == 0;
else
chroma = (line & 1) == 1;
break;
case 2:
- if (!yoffset)
+ if (topfield)
chroma = (line & 3) == 0;
else
chroma = (line & 3) == 2;