Skip to content

Commit c696ef0

Browse files
drivers: video: fix uninitialized struct in ov2640_init()
Initialize fmt with default format and zero pitch to fix Coverity. CID: 524780 Signed-off-by: Gaetan Perrot <[email protected]>
1 parent 350a5ef commit c696ef0

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/video/ov2640.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,8 +1000,13 @@ static int ov2640_init_controls(const struct device *dev)
10001000

10011001
static int ov2640_init(const struct device *dev)
10021002
{
1003-
struct video_format fmt;
10041003
int ret = 0;
1004+
/* set default/init format SVGA RGB565 */
1005+
struct video_format fmt = {
1006+
.pixelformat = VIDEO_PIX_FMT_RGB565,
1007+
.width = SVGA_HSIZE,
1008+
.height = SVGA_VSIZE,
1009+
};
10051010

10061011
#if DT_INST_NODE_HAS_PROP(0, reset_gpios)
10071012
const struct ov2640_config *cfg = dev->config;
@@ -1028,10 +1033,6 @@ static int ov2640_init(const struct device *dev)
10281033

10291034
ov2640_write_all(dev, default_regs, ARRAY_SIZE(default_regs));
10301035

1031-
/* set default/init format SVGA RGB565 */
1032-
fmt.pixelformat = VIDEO_PIX_FMT_RGB565;
1033-
fmt.width = SVGA_HSIZE;
1034-
fmt.height = SVGA_VSIZE;
10351036
ret = ov2640_set_fmt(dev, &fmt);
10361037
if (ret) {
10371038
LOG_ERR("Unable to configure default format");

0 commit comments

Comments
 (0)