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>
This commit is contained in:
Sakari Ailus 2021-03-12 11:43:08 +01:00 committed by Mauro Carvalho Chehab
parent a1946caf02
commit ba689d9333

View File

@ -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;