Commit df5c3e7c authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

[media] v4l: vsp1: Fix plane stride and size checks

The checks need to be performed on up to two planes, as the third plane,
if present, must have the same stride and size as the second plane.

The code incorrectly performs the checks on at least two planes instead
of at most two planes, fix it.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent e31f8f00
......@@ -245,7 +245,7 @@ static int __vsp1_video_try_format(struct vsp1_video *video,
* the datasheet, strides not aligned to a multiple of 128 bytes result
* in image corruption.
*/
for (i = 0; i < max(info->planes, 2U); ++i) {
for (i = 0; i < min(info->planes, 2U); ++i) {
unsigned int hsub = i > 0 ? info->hsub : 1;
unsigned int vsub = i > 0 ? info->vsub : 1;
unsigned int align = 128;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment