Skip to content
/ linux Public

Commit dd1bdab

Browse files
Hans VerkuilSasha Levin
authored andcommitted
media: omap3isp: isp_video_mbus_to_pix/pix_to_mbus fixes
[ Upstream commit 44c0380 ] The isp_video_mbus_to_pix/pix_to_mbus functions did not take the last empty entry { 0, } of the formats array into account. As a result, isp_video_mbus_to_pix would accept code 0 and isp_video_pix_to_mbus would select code 0 if no match was found. Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 0290934 commit dd1bdab

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/media/platform/ti/omap3isp/ispvideo.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@ static unsigned int isp_video_mbus_to_pix(const struct isp_video *video,
148148
pix->width = mbus->width;
149149
pix->height = mbus->height;
150150

151-
for (i = 0; i < ARRAY_SIZE(formats); ++i) {
151+
for (i = 0; i < ARRAY_SIZE(formats) - 1; ++i) {
152152
if (formats[i].code == mbus->code)
153153
break;
154154
}
155155

156-
if (WARN_ON(i == ARRAY_SIZE(formats)))
156+
if (WARN_ON(i == ARRAY_SIZE(formats) - 1))
157157
return 0;
158158

159159
min_bpl = pix->width * formats[i].bpp;
@@ -191,7 +191,7 @@ static void isp_video_pix_to_mbus(const struct v4l2_pix_format *pix,
191191
/* Skip the last format in the loop so that it will be selected if no
192192
* match is found.
193193
*/
194-
for (i = 0; i < ARRAY_SIZE(formats) - 1; ++i) {
194+
for (i = 0; i < ARRAY_SIZE(formats) - 2; ++i) {
195195
if (formats[i].pixelformat == pix->pixelformat)
196196
break;
197197
}

0 commit comments

Comments
 (0)