From a34928a678f96eb1f6aa1e69497bebf0c193169b Mon Sep 17 00:00:00 2001 From: Jeongtae Park Date: Mon, 30 Apr 2018 10:16:34 +0900 Subject: [PATCH] [COMMON] fimc-is2: add sanity checking for selected sub-device ch. mode Change-Id: I521143efe488005578e93e3b7f2b625ce3d79c43 Signed-off-by: Jeongtae Park --- .../media/platform/exynos/fimc-is2/fimc-is-device-csi_v4.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/media/platform/exynos/fimc-is2/fimc-is-device-csi_v4.c b/drivers/media/platform/exynos/fimc-is2/fimc-is-device-csi_v4.c index e11f22f82404..9af480e88db2 100644 --- a/drivers/media/platform/exynos/fimc-is2/fimc-is-device-csi_v4.c +++ b/drivers/media/platform/exynos/fimc-is2/fimc-is-device-csi_v4.c @@ -1748,6 +1748,12 @@ static int csi_s_format(struct v4l2_subdev *subdev, else csi->scm = SCM_W_PAF_HW; + if (csi->scm >= csi->num_of_scm) { + merr("invalid sub-device channel mode(%d/%d)", csi, + csi->scm, csi->num_of_scm); + return -EINVAL; + } + /* * DMA HW doesn't have own reset register. * So, all virtual ch dma should be disabled -- 2.20.1