summaryrefslogtreecommitdiffstats
path: root/drivers/media/pci/bt8xx
diff options
context:
space:
mode:
authorSamuel Williams <sam8641@gmail.com>2018-04-01 17:00:27 +0200
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-05-04 21:27:31 +0200
commit6f7e780b7e93aed10fe5d32f386add042644cb0b (patch)
tree92852828b7428ff680a0ed0f378561a95f4f930a /drivers/media/pci/bt8xx
parentmedia: tuners/qm1d1c0042: use SPDX License Identifier (diff)
downloadlinux-6f7e780b7e93aed10fe5d32f386add042644cb0b.tar.xz
linux-6f7e780b7e93aed10fe5d32f386add042644cb0b.zip
media: bttv: Fixed oops error when capturing at yuv410p
When capturing at yuv410p, sg_next was called too many times when chroma is false, eventually returning NULL. This patch does fix this for my hardware. Signed-off-by: Samuel Williams <sam8641@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/pci/bt8xx')
-rw-r--r--drivers/media/pci/bt8xx/bttv-risc.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/media/pci/bt8xx/bttv-risc.c b/drivers/media/pci/bt8xx/bttv-risc.c
index 3859dde98be2..6a6be0b49f70 100644
--- a/drivers/media/pci/bt8xx/bttv-risc.c
+++ b/drivers/media/pci/bt8xx/bttv-risc.c
@@ -189,20 +189,21 @@ bttv_risc_planar(struct bttv *btv, struct btcx_riscmem *risc,
yoffset -= sg_dma_len(ysg);
ysg = sg_next(ysg);
}
- while (uoffset && uoffset >= sg_dma_len(usg)) {
- uoffset -= sg_dma_len(usg);
- usg = sg_next(usg);
- }
- while (voffset && voffset >= sg_dma_len(vsg)) {
- voffset -= sg_dma_len(vsg);
- vsg = sg_next(vsg);
- }
/* calculate max number of bytes we can write */
ylen = todo;
if (yoffset + ylen > sg_dma_len(ysg))
ylen = sg_dma_len(ysg) - yoffset;
if (chroma) {
+ while (uoffset && uoffset >= sg_dma_len(usg)) {
+ uoffset -= sg_dma_len(usg);
+ usg = sg_next(usg);
+ }
+ while (voffset && voffset >= sg_dma_len(vsg)) {
+ voffset -= sg_dma_len(vsg);
+ vsg = sg_next(vsg);
+ }
+
if (uoffset + (ylen>>hshift) > sg_dma_len(usg))
ylen = (sg_dma_len(usg) - uoffset) << hshift;
if (voffset + (ylen>>hshift) > sg_dma_len(vsg))