Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6f7e780b authored by Samuel Williams's avatar Samuel Williams Committed by Mauro Carvalho Chehab
Browse files

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: default avatarSamuel Williams <sam8641@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent a03e457b
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -189,6 +189,12 @@ bttv_risc_planar(struct bttv *btv, struct btcx_riscmem *risc,
				yoffset -= sg_dma_len(ysg);
				ysg = sg_next(ysg);
			}

			/* 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);
@@ -198,11 +204,6 @@ bttv_risc_planar(struct bttv *btv, struct btcx_riscmem *risc,
					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) {
				if (uoffset + (ylen>>hshift) > sg_dma_len(usg))
					ylen = (sg_dma_len(usg) - uoffset) << hshift;
				if (voffset + (ylen>>hshift) > sg_dma_len(vsg))