Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 00542edf authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab
Browse files

[media] omap3isp: Don't accept pipelines with no video source as valid



Make sure the pipeline has a valid video source (either a subdev with no
sink pad, or a non-subdev entity) at stream-on time and return -EPIPE if
no video source can be found.

Reported-by: default avatarJonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent b796fb6e
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -278,7 +278,8 @@ isp_video_far_end(struct isp_video *video)
 * limits reported by every block in the pipeline.
 *
 * Return 0 if all formats match, or -EPIPE if at least one link is found with
 * different formats on its two ends.
 * different formats on its two ends or if the pipeline doesn't start with a
 * video source (either a subdev with no input pad, or a non-subdev entity).
 */
static int isp_video_validate_pipeline(struct isp_pipeline *pipe)
{
@@ -329,10 +330,15 @@ static int isp_video_validate_pipeline(struct isp_pipeline *pipe)
		 * in the middle of it. */
		shifter_link = subdev == &isp->isp_ccdc.subdev;

		/* Retrieve the source format */
		/* Retrieve the source format. Return an error if no source
		 * entity can be found, and stop checking the pipeline if the
		 * source entity isn't a subdev.
		 */
		pad = media_entity_remote_source(pad);
		if (pad == NULL ||
		    media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
		if (pad == NULL)
			return -EPIPE;

		if (media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
			break;

		subdev = media_entity_to_v4l2_subdev(pad->entity);