media: tc358743: validate lane count
authorPhilipp Zabel <p.zabel@pengutronix.de>
Tue, 17 Oct 2017 11:05:11 +0000 (13:05 +0200)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Fri, 27 Oct 2017 14:15:36 +0000 (16:15 +0200)
The TC358743 does not support more than 4 data lanes. Check that the
lane count is valid.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/i2c/tc358743.c

index 0b65096613d916833003a157dbf4525e77595c4d..d3cf016ad0a00436a803b3fde3978c71e1060781 100644 (file)
@@ -1941,6 +1941,11 @@ static int tc358743_probe_of(struct tc358743_state *state)
                goto free_endpoint;
        }
 
+       if (endpoint->bus.mipi_csi2.num_data_lanes > 4) {
+               dev_err(dev, "invalid number of lanes\n");
+               goto free_endpoint;
+       }
+
        state->bus = endpoint->bus.mipi_csi2;
 
        ret = clk_prepare_enable(refclk);