From f05e72324ce42c1cbe1b965959c45772d8b6523b Mon Sep 17 00:00:00 2001 From: wangming9 Date: Wed, 30 Aug 2023 21:55:31 +0800 Subject: [PATCH] drivers/video: fix build error on CONFIG_DEBUG_OPTLEVEL="-O3" Summary The following compilation error occurs after configuring CONFIG_DEBUG_OPTLEVEL="-O3" CC: ping.c video/video.c: In function 'video_ioctl': video/video.c:2347:22: error: 'control.size' may be used uninitialized [-Werror=maybe-uninitialized] 2347 | control->size, | ^~ video/video.c:2273:28: note: 'control' declared here 2273 | struct v4l2_ext_control control; | ^~~~~~~ Signed-off-by: wangming9 --- drivers/video/video.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/video/video.c b/drivers/video/video.c index 21b262c35a..a3ba606b01 100644 --- a/drivers/video/video.c +++ b/drivers/video/video.c @@ -2276,6 +2276,9 @@ static int video_g_ctrl(FAR struct video_mng_s *priv, struct v4l2_ext_control control; int ret; + memset(&ext_controls, 0, sizeof(struct v4l2_ext_controls)); + memset(&control, 0, sizeof(struct v4l2_ext_control)); + if (ctrl == NULL) { return -EINVAL;