summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/omap3isp
diff options
context:
space:
mode:
authorSakari Ailus2015-03-25 23:57:26 +0100
committerMauro Carvalho Chehab2015-04-02 21:37:21 +0200
commit8b3aff7cdd6c2e7c9a3df755b23525e393195102 (patch)
tree51ec63fcd7afa4129baa1dcc0d13891469d861c6 /drivers/media/platform/omap3isp
parent[media] omap3isp: Fix error handling in probe (diff)
downloadkernel-qcow2-linux-8b3aff7cdd6c2e7c9a3df755b23525e393195102.tar.gz
kernel-qcow2-linux-8b3aff7cdd6c2e7c9a3df755b23525e393195102.tar.xz
kernel-qcow2-linux-8b3aff7cdd6c2e7c9a3df755b23525e393195102.zip
[media] omap3isp: Avoid a BUG_ON() in media_entity_create_link()
If an uninitialised v4l2_subdev struct was passed to media_entity_create_link(), one of the BUG_ON()'s in the function will be hit since media_entity.num_pads will be zero. Avoid this by checking whether the num_pads field is non-zero for the interface. Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/platform/omap3isp')
-rw-r--r--drivers/media/platform/omap3isp/isp.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
index fb193b65b5ce..4ab674dd43c1 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -1946,6 +1946,19 @@ static int isp_register_entities(struct isp_device *isp)
goto done;
}
+ /*
+ * Not all interfaces are available on all revisions
+ * of the ISP. The sub-devices of those interfaces
+ * aren't initialised in such a case. Check this by
+ * ensuring the num_pads is non-zero.
+ */
+ if (!input->num_pads) {
+ dev_err(isp->dev, "%s: invalid input %u\n",
+ entity->name, subdevs->interface);
+ ret = -EINVAL;
+ goto done;
+ }
+
for (i = 0; i < sensor->entity.num_pads; i++) {
if (sensor->entity.pads[i].flags & MEDIA_PAD_FL_SOURCE)
break;