소스 검색

[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: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Laurent Pinchart 10 년 전
부모
커밋
df5c3e7c8a
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      drivers/media/platform/vsp1/vsp1_video.c

+ 1 - 1
drivers/media/platform/vsp1/vsp1_video.c

@@ -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
 	 * the datasheet, strides not aligned to a multiple of 128 bytes result
 	 * in image corruption.
 	 * 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 hsub = i > 0 ? info->hsub : 1;
 		unsigned int vsub = i > 0 ? info->vsub : 1;
 		unsigned int vsub = i > 0 ? info->vsub : 1;
 		unsigned int align = 128;
 		unsigned int align = 128;