Commit 3fb0cf48 authored by sudarsan N's avatar sudarsan N Committed by Fabio Baltieri
Browse files

drivers: video: fix uninitialized struct



Zero-initialize fmt to fix Coverity.

CID:525180
CID 524760
CID 524753
CID 524781
CID 524755

Signed-off-by: default avatarsudarsan N <sudarsansamy2002@gmail.com>
parent ab99a53a
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -528,7 +528,11 @@ static int mt9m114_init_controls(const struct device *dev)
static int mt9m114_init(const struct device *dev)
{
	const struct mt9m114_config *cfg = dev->config;
	struct video_format fmt;
	struct video_format fmt = {
		.pixelformat = VIDEO_PIX_FMT_RGB565,
		.width = 480,
		.height = 272,
	};
	uint16_t val;
	int ret;

@@ -561,11 +565,6 @@ static int mt9m114_init(const struct device *dev)
		return ret;
	}

	/* Set default format to 480x272 RGB565 */
	fmt.pixelformat = VIDEO_PIX_FMT_RGB565;
	fmt.width = 480;
	fmt.height = 272;

	ret = mt9m114_set_fmt(dev, &fmt);
	if (ret) {
		LOG_ERR("Unable to configure default format");
+1 −1
Original line number Diff line number Diff line
@@ -1324,7 +1324,7 @@ static int ov5640_init_controls(const struct device *dev)
static int ov5640_init(const struct device *dev)
{
	const struct ov5640_config *cfg = dev->config;
	struct video_format fmt;
	struct video_format fmt = {0};
	uint16_t chip_id;
	int ret;

+5 −5
Original line number Diff line number Diff line
@@ -489,7 +489,11 @@ static int ov7670_init(const struct device *dev)
	const struct ov7670_config *config = dev->config;
	int ret, i;
	uint8_t pid;
	struct video_format fmt;
	struct video_format fmt = {
		.pixelformat = VIDEO_PIX_FMT_RGB565,
		.width = 320,
		.height = 240,
	};
	const struct ov7670_reg *reg;

	if (!i2c_is_ready_dt(&config->bus)) {
@@ -563,10 +567,6 @@ static int ov7670_init(const struct device *dev)
	/* Delay after reset */
	k_msleep(5);

	/* Set default camera format (QVGA, YUYV) */
	fmt.pixelformat = VIDEO_PIX_FMT_RGB565;
	fmt.width = 320;
	fmt.height = 240;
	ret = ov7670_set_fmt(dev, &fmt);
	if (ret < 0) {
		return ret;
+6 −6
Original line number Diff line number Diff line
@@ -326,7 +326,12 @@ static int ov9655_get_fmt(const struct device *dev, struct video_format *fmt)
static int ov9655_init(const struct device *dev)
{
	const struct ov9655_config *config = dev->config;
	struct video_format fmt;
	/* Set default camera format (QQVGA, YUYV) */
	struct video_format fmt = {
		.pixelformat = VIDEO_PIX_FMT_YUYV,
		.width = 160,
		.height = 120,
	};
	uint32_t pid;
	int ret;

@@ -380,11 +385,6 @@ static int ov9655_init(const struct device *dev)
		return -ENODEV;
	}

	/* Set default camera format (QQVGA, YUYV) */
	fmt.pixelformat = VIDEO_PIX_FMT_YUYV;
	fmt.width = 160;
	fmt.height = 120;

	return ov9655_set_fmt(dev, &fmt);
}

+5 −5
Original line number Diff line number Diff line
@@ -344,7 +344,11 @@ static int emul_imager_init_controls(const struct device *dev)

int emul_imager_init(const struct device *dev)
{
	struct video_format fmt;
	struct video_format fmt = {
		.pixelformat = fmts[0].pixelformat,
		.width = fmts[0].width_min,
		.height = fmts[0].height_min,
	};
	uint8_t sensor_id;
	int ret;

@@ -365,10 +369,6 @@ int emul_imager_init(const struct device *dev)
		return ret;
	}

	fmt.pixelformat = fmts[0].pixelformat;
	fmt.width = fmts[0].width_min;
	fmt.height = fmts[0].height_min;

	ret = emul_imager_set_fmt(dev, &fmt);
	if (ret < 0) {
		LOG_ERR("Failed to set to default format %x %ux%u",