summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@linux.intel.com>2021-03-12 11:43:08 +0100
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-04-06 14:34:20 +0200
commitba689d93336161f195258ccf9333f0e51ce6e85f (patch)
tree49907590d646721d10df31199e5da93f4bb611db
parenta1946caf02fcc1fa978de43ceb247c4614d16216 (diff)
media: omap3isp: Acquire graph mutex for graph traversal
Acquire the graph_mutex for traversing the media graph. This seems to have been missing all the time. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
-rw-r--r--drivers/media/platform/omap3isp/isp.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
index a6bb7d9bf75f..53025c8c7531 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -691,6 +691,8 @@ static int isp_pipeline_enable(struct isp_pipeline *pipe,
pipe->do_propagation = false;
+ mutex_lock(&isp->media_dev.graph_mutex);
+
entity = &pipe->output->video.entity;
while (1) {
pad = &entity->pads[0];
@@ -705,8 +707,10 @@ static int isp_pipeline_enable(struct isp_pipeline *pipe,
subdev = media_entity_to_v4l2_subdev(entity);
ret = v4l2_subdev_call(subdev, video, s_stream, mode);
- if (ret < 0 && ret != -ENOIOCTLCMD)
+ if (ret < 0 && ret != -ENOIOCTLCMD) {
+ mutex_unlock(&isp->media_dev.graph_mutex);
return ret;
+ }
if (subdev == &isp->isp_ccdc.subdev) {
v4l2_subdev_call(&isp->isp_aewb.subdev, video,
@@ -723,6 +727,8 @@ static int isp_pipeline_enable(struct isp_pipeline *pipe,
break;
}
+ mutex_unlock(&isp->media_dev.graph_mutex);
+
return 0;
}
@@ -2028,6 +2034,8 @@ static int isp_subdev_notifier_complete(struct v4l2_async_notifier *async)
struct v4l2_subdev *sd;
int ret;
+ mutex_lock(&isp->media_dev.graph_mutex);
+
ret = media_entity_enum_init(&isp->crashed, &isp->media_dev);
if (ret)
return ret;
@@ -2038,10 +2046,14 @@ static int isp_subdev_notifier_complete(struct v4l2_async_notifier *async)
ret = isp_link_entity(isp, &sd->entity,
v4l2_subdev_to_bus_cfg(sd)->interface);
- if (ret < 0)
+ if (ret < 0) {
+ mutex_unlock(&isp->media_dev.graph_mutex);
return ret;
+ }
}
+ mutex_unlock(&isp->media_dev.graph_mutex);
+
ret = v4l2_device_register_subdev_nodes(&isp->v4l2_dev);
if (ret < 0)
return ret;