From 73278d483378cf850ade923a1107a70297b2602a Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 12 Dec 2022 08:32:20 +0000 Subject: media: v4l2-ctrls-api.c: add back dropped ctrl->is_new = 1 The patch adding support for dynamically allocated arrays accidentally dropped the line setting ctrl->is_new to 1, thus new string values were always ignored. Fixes: fb582cba4492 ("media: v4l2-ctrls: add support for dynamically allocated arrays.") Reported-by: Alice Yuan Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/v4l2-ctrls-api.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/media') diff --git a/drivers/media/v4l2-core/v4l2-ctrls-api.c b/drivers/media/v4l2-core/v4l2-ctrls-api.c index d0a3aa3806fb..3d3b6dc24ca6 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls-api.c +++ b/drivers/media/v4l2-core/v4l2-ctrls-api.c @@ -150,6 +150,7 @@ static int user_to_new(struct v4l2_ext_control *c, struct v4l2_ctrl *ctrl) * then return an error. */ if (strlen(ctrl->p_new.p_char) == ctrl->maximum && last) + ctrl->is_new = 1; return -ERANGE; } return ret; -- cgit v1.2.3 From 7fabed7ae6185ef7f5967f3a2271c906ec6b7b7d Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Thu, 8 Dec 2022 15:19:56 +0100 Subject: media: sun6i-csi: bridge: Error out on invalid port to fix warning The enabled variable is only set for a valid port and used later, which triggers an uninitialized use smatch warning. Explicitly error out in that case to fix the warning. Signed-off-by: Paul Kocialkowski Fixes: 0d2b746b1bef ("media: sun6i-csi: Add bridge v4l2 subdev with port management") Signed-off-by: Sakari Ailus Signed-off-by: Hans Verkuil --- drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_bridge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media') diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_bridge.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_bridge.c index ebfc870d2af5..4db950973ce2 100644 --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_bridge.c +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_bridge.c @@ -663,7 +663,7 @@ sun6i_csi_bridge_notifier_bound(struct v4l2_async_notifier *notifier, enabled = !bridge->source_parallel.expected; break; default: - break; + return -EINVAL; } source->subdev = remote_subdev; -- cgit v1.2.3 From f2c174e5018ed3360fdfeb6f9cd5c05e6086d134 Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Thu, 8 Dec 2022 15:19:58 +0100 Subject: media: sun6i-csi: capture: Remove useless ret initialization There is no particular need to assign ret when declaring it as it will be assigned before there is any chance to return it. Signed-off-by: Paul Kocialkowski Signed-off-by: Sakari Ailus Signed-off-by: Hans Verkuil --- drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media') diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.c index 6d34f5c0768f..cf6aadbc130b 100644 --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.c +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.c @@ -832,7 +832,7 @@ static int sun6i_csi_capture_open(struct file *file) { struct sun6i_csi_device *csi_dev = video_drvdata(file); struct sun6i_csi_capture *capture = &csi_dev->capture; - int ret = 0; + int ret; if (mutex_lock_interruptible(&capture->lock)) return -ERESTARTSYS; -- cgit v1.2.3 From 52109d91d2f91e9cc7a14ee46443e374a21573cf Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Thu, 8 Dec 2022 15:19:59 +0100 Subject: media: sun6i-mipi-csi2: Clarify return code handling in stream off path Explicitly set ret to zero instead of assigning it and overwriting it later, which is a bit confusing to understand. Signed-off-by: Paul Kocialkowski Signed-off-by: Sakari Ailus Signed-off-by: Hans Verkuil --- drivers/media/platform/sunxi/sun6i-mipi-csi2/sun6i_mipi_csi2.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers/media') diff --git a/drivers/media/platform/sunxi/sun6i-mipi-csi2/sun6i_mipi_csi2.c b/drivers/media/platform/sunxi/sun6i-mipi-csi2/sun6i_mipi_csi2.c index 484ac5f054d5..a220ce849b41 100644 --- a/drivers/media/platform/sunxi/sun6i-mipi-csi2/sun6i_mipi_csi2.c +++ b/drivers/media/platform/sunxi/sun6i-mipi-csi2/sun6i_mipi_csi2.c @@ -188,7 +188,8 @@ static int sun6i_mipi_csi2_s_stream(struct v4l2_subdev *subdev, int on) return -ENODEV; if (!on) { - ret = v4l2_subdev_call(source_subdev, video, s_stream, 0); + v4l2_subdev_call(source_subdev, video, s_stream, 0); + ret = 0; goto disable; } @@ -280,8 +281,6 @@ static int sun6i_mipi_csi2_s_stream(struct v4l2_subdev *subdev, int on) return 0; disable: - if (!on) - ret = 0; phy_power_off(dphy); sun6i_mipi_csi2_disable(csi2_dev); -- cgit v1.2.3 From 761ebebabd0953fde1e6b77d6ff54356dc1639c4 Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Thu, 8 Dec 2022 15:20:00 +0100 Subject: media: sun8i-a83t-mipi-csi2: Clarify return code handling in stream off path Explicitly set ret to zero instead of assigning it and overwriting it later, which is a bit confusing to understand. Signed-off-by: Paul Kocialkowski Signed-off-by: Sakari Ailus Signed-off-by: Hans Verkuil --- .../media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_mipi_csi2.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers/media') diff --git a/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_mipi_csi2.c b/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_mipi_csi2.c index d993c09a4820..cd2e92ae2293 100644 --- a/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_mipi_csi2.c +++ b/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_mipi_csi2.c @@ -220,7 +220,8 @@ static int sun8i_a83t_mipi_csi2_s_stream(struct v4l2_subdev *subdev, int on) return -ENODEV; if (!on) { - ret = v4l2_subdev_call(source_subdev, video, s_stream, 0); + v4l2_subdev_call(source_subdev, video, s_stream, 0); + ret = 0; goto disable; } @@ -312,8 +313,6 @@ static int sun8i_a83t_mipi_csi2_s_stream(struct v4l2_subdev *subdev, int on) return 0; disable: - if (!on) - ret = 0; phy_power_off(dphy); sun8i_a83t_mipi_csi2_disable(csi2_dev); -- cgit v1.2.3