Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1513153

[PATCH] [media] atmel-isc: release the filehandle if it's not the only one.

From Songjun Wu <songjun.wu@microchip.com>
Newsgroups linux.kernel
Subject [PATCH] [media] atmel-isc: release the filehandle if it's not the only one.
Date 2016-11-01 09:20 +0100
Message-ID <syCsx-6ac-5@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Release the filehandle in 'isc_open' if it's not the only filehandle
opened for the associated video_device.

Signed-off-by: Songjun Wu <songjun.wu@microchip.com>
---

 drivers/media/platform/atmel/atmel-isc.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/media/platform/atmel/atmel-isc.c b/drivers/media/platform/atmel/atmel-isc.c
index 8e25d3f..5e08404 100644
--- a/drivers/media/platform/atmel/atmel-isc.c
+++ b/drivers/media/platform/atmel/atmel-isc.c
@@ -926,21 +926,21 @@ static int isc_open(struct file *file)
 	if (ret < 0)
 		goto unlock;
 
-	if (!v4l2_fh_is_singular_file(file))
-		goto unlock;
+	ret = !v4l2_fh_is_singular_file(file);
+	if (ret)
+		goto fh_rel;
 
 	ret = v4l2_subdev_call(sd, core, s_power, 1);
-	if (ret < 0 && ret != -ENOIOCTLCMD) {
-		v4l2_fh_release(file);
-		goto unlock;
-	}
+	if (ret < 0 && ret != -ENOIOCTLCMD)
+		goto fh_rel;
 
 	ret = isc_set_fmt(isc, &isc->fmt);
-	if (ret) {
+	if (ret)
 		v4l2_subdev_call(sd, core, s_power, 0);
-		v4l2_fh_release(file);
-	}
 
+fh_rel:
+	if (ret)
+		v4l2_fh_release(file);
 unlock:
 	mutex_unlock(&isc->lock);
 	return ret;
-- 
2.7.4

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] [media] atmel-isc: release the filehandle if it's not the only one. Songjun Wu <songjun.wu@microchip.com> - 2016-11-01 09:20 +0100
  Re: [PATCH] [media] atmel-isc: release the filehandle if it's not the  only one. Hans Verkuil <hverkuil@xs4all.nl> - 2016-11-01 10:00 +0100
    Re: [PATCH] [media] atmel-isc: release the filehandle if it's not the  only one. "Wu, Songjun" <Songjun.Wu@microchip.com> - 2016-11-01 10:10 +0100

csiph-web