Skip to content

Commit b887cc4

Browse files
iabdalkaderkartben
authored andcommitted
drivers: video: gc2145: Fix video_format_cap array.
video_format_cap needs to be terminated with a NULL entry to allow looping over the formats. Signed-off-by: Ibrahim Abdalkader <[email protected]>
1 parent 85aebac commit b887cc4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/video/gc2145.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,7 @@ static const struct video_format_cap fmts[] = {
717717
GC2145_VIDEO_FORMAT_CAP(RESOLUTION_QVGA_W, RESOLUTION_QVGA_H, VIDEO_PIX_FMT_YUYV),
718718
GC2145_VIDEO_FORMAT_CAP(RESOLUTION_VGA_W, RESOLUTION_VGA_H, VIDEO_PIX_FMT_YUYV),
719719
GC2145_VIDEO_FORMAT_CAP(RESOLUTION_UXGA_W, RESOLUTION_UXGA_H, VIDEO_PIX_FMT_YUYV),
720+
{0},
720721
};
721722

722723
static int gc2145_write_reg(const struct i2c_dt_spec *spec, uint8_t reg_addr, uint8_t value)
@@ -1042,7 +1043,7 @@ static int gc2145_set_fmt(const struct device *dev, enum video_endpoint_id ep,
10421043
}
10431044

10441045
/* Check if camera is capable of handling given format */
1045-
for (int i = 0; i < ARRAY_SIZE(fmts); i++) {
1046+
for (int i = 0; i < ARRAY_SIZE(fmts) - 1; i++) {
10461047
if (fmts[i].width_min == fmt->width && fmts[i].height_min == fmt->height &&
10471048
fmts[i].pixelformat == fmt->pixelformat) {
10481049
res = i;

0 commit comments

Comments
 (0)