diff mbox series

[v3,3/3] media: i2c: ov5640: Fail probe on unsupported bus_type

Message ID 20200813171337.5540-4-prabhakar.mahadev-lad.rj@bp.renesas.com (mailing list archive)
State New, archived
Headers show
Series media: i2c: ov5640 feature enhancement and fixes | expand

Commit Message

Lad Prabhakar Aug. 13, 2020, 5:13 p.m. UTC
Fail probe if unsupported bus_type is detected.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
 drivers/media/i2c/ov5640.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Jacopo Mondi Sept. 4, 2020, 10:44 a.m. UTC | #1
Hi Prabhakar

On Thu, Aug 13, 2020 at 06:13:37PM +0100, Lad Prabhakar wrote:
> Fail probe if unsupported bus_type is detected.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Thanks

Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>


> ---
>  drivers/media/i2c/ov5640.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
> index 160d2857352a..3191e2b223c3 100644
> --- a/drivers/media/i2c/ov5640.c
> +++ b/drivers/media/i2c/ov5640.c
> @@ -3078,6 +3078,13 @@ static int ov5640_probe(struct i2c_client *client)
>  		return ret;
>  	}
>
> +	if (sensor->ep.bus_type != V4L2_MBUS_PARALLEL &&
> +	    sensor->ep.bus_type != V4L2_MBUS_CSI2_DPHY &&
> +	    sensor->ep.bus_type != V4L2_MBUS_BT656) {
> +		dev_err(dev, "Unsupported bus type %d\n", sensor->ep.bus_type);
> +		return -EINVAL;
> +	}
> +
>  	/* get system clock (xclk) */
>  	sensor->xclk = devm_clk_get(dev, "xclk");
>  	if (IS_ERR(sensor->xclk)) {
> --
> 2.17.1
>
diff mbox series

Patch

diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
index 160d2857352a..3191e2b223c3 100644
--- a/drivers/media/i2c/ov5640.c
+++ b/drivers/media/i2c/ov5640.c
@@ -3078,6 +3078,13 @@  static int ov5640_probe(struct i2c_client *client)
 		return ret;
 	}
 
+	if (sensor->ep.bus_type != V4L2_MBUS_PARALLEL &&
+	    sensor->ep.bus_type != V4L2_MBUS_CSI2_DPHY &&
+	    sensor->ep.bus_type != V4L2_MBUS_BT656) {
+		dev_err(dev, "Unsupported bus type %d\n", sensor->ep.bus_type);
+		return -EINVAL;
+	}
+
 	/* get system clock (xclk) */
 	sensor->xclk = devm_clk_get(dev, "xclk");
 	if (IS_ERR(sensor->xclk)) {