LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] media: sun6i-csi: Allow the video device to be open multiple times
@ 2021-09-08 10:56 Ondrej Jirman
  2021-09-08 18:24 ` Jernej Škrabec
  0 siblings, 1 reply; 2+ messages in thread
From: Ondrej Jirman @ 2021-09-08 10:56 UTC (permalink / raw)
  To: Yong Deng, Mauro Carvalho Chehab, Maxime Ripard, Chen-Yu Tsai,
	Jernej Skrabec, open list:CSI DRIVERS FOR ALLWINNER V3s,
	moderated list:ARM/Allwinner sunXi SoC support,
	open list:ARM/Allwinner sunXi SoC support, open list
  Cc: Ondrej Jirman

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")
Signed-off-by: Ondrej Jirman <megous@megous.com>
---
 drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c
index 0129dee798b4..da1f8b2852b7 100644
--- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c
+++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c
@@ -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)
-- 
2.33.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] media: sun6i-csi: Allow the video device to be open multiple times
  2021-09-08 10:56 [PATCH] media: sun6i-csi: Allow the video device to be open multiple times Ondrej Jirman
@ 2021-09-08 18:24 ` Jernej Škrabec
  0 siblings, 0 replies; 2+ messages in thread
From: Jernej Škrabec @ 2021-09-08 18:24 UTC (permalink / raw)
  To: Yong Deng, Mauro Carvalho Chehab, Maxime Ripard, Chen-Yu Tsai,
	open list:CSI DRIVERS FOR ALLWINNER V3s,
	moderated list:ARM/Allwinner sunXi SoC support,
	open list:ARM/Allwinner sunXi SoC support, open list,
	Ondrej Jirman
  Cc: Ondrej Jirman

Hi Ondrej!

Dne sreda, 08. september 2021 ob 12:56:09 CEST je Ondrej Jirman napisal(a):
> 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

> Signed-off-by: Ondrej Jirman <megous@megous.com>

Otherwise:
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>

Best regards,
Jernej



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-08 18:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-08 10:56 [PATCH] media: sun6i-csi: Allow the video device to be open multiple times Ondrej Jirman
2021-09-08 18:24 ` Jernej Škrabec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).