Skip to contentSkip to conversation

media: sun6i-csi: Allow the video device to be open multiple times

PATCH In review Ondrej Jirman 2 participants 2 messages Sep 8, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: sun6i-csi: Allow the video device to be open multiple times

Previously it was possible, but a recent fix for uninitialized ret variable broke this behavior.

v4l2_fh_is_singular_file() check is there just to determine whether the power needs to be enabled, and it's not a failure if it returns false.

Fixes ba9139116bc0538 ("media: sun6i-csi: add a missing return code")
---
 drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c +2 -4
index 0129dee798b4..da1f8b2852b7 100644
@@ -510,7 +510,7 @@ static const struct v4l2_ioctl_ops sun6i_video_ioctl_ops = {
 static int sun6i_video_open(struct file *file)
 {
 	struct sun6i_video *video = video_drvdata(file);
-	int ret;
+	int ret = 0;
 
 	if (mutex_lock_interruptible(&video->lock))
 		return -ERESTARTSYS;
@@ -524,10 +524,8 @@ static int sun6i_video_open(struct file *file)
 		goto fh_release;
 
 	/* check if already powered */
-	if (!v4l2_fh_is_singular_file(file)) {
-		ret = -EBUSY;
+	if (!v4l2_fh_is_singular_file(file))
 		goto unlock;
-	}
 
 	ret = sun6i_csi_set_power(video->csi, true);
 	if (ret < 0)
Signature · 1 line
2.33.0
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi Ondrej!

Dne sreda, 08. september 2021 ob 12:56:09 CEST je Ondrej Jirman napisal(a):

Quoted 8 lines

Previously it was possible, but a recent fix for uninitialized ret variable broke this behavior.

v4l2_fh_is_singular_file() check is there just to determine whether the power needs to be enabled, and it's not a failure if it returns false.

Fixes ba9139116bc0538 ("media: sun6i-csi: add a missing return code")

Only 12 characters for SHA-1 ID

Quoted 1 line

Otherwise:

Best regards,
Jernej