On Mon, Dec 12, 2016 at 04:55:07PM +0100, Hans Verkuil wrote:
> From: Hans Verkuil <[email protected]>
> 
> Add v4l2-async support for this driver.
> 
> Signed-off-by: Hans Verkuil <[email protected]>
> ---
>  drivers/media/i2c/ov7670.c | 21 +++++++++++++++------
>  1 file changed, 15 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c
> index b0315bb..3f0522f 100644
> --- a/drivers/media/i2c/ov7670.c
> +++ b/drivers/media/i2c/ov7670.c
> @@ -1641,18 +1641,15 @@ static int ov7670_probe(struct i2c_client *client,
>       if (info->hdl.error) {
>               int err = info->hdl.error;
>  
> -             v4l2_ctrl_handler_free(&info->hdl);
> -             return err;
> +             goto fail;
>       }
>  
>  #if defined(CONFIG_MEDIA_CONTROLLER)
>       info->pad.flags = MEDIA_PAD_FL_SOURCE;
>       info->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
>       ret = media_entity_pads_init(&info->sd.entity, 1, &info->pad);
> -     if (ret < 0) {
> -             v4l2_ctrl_handler_free(&info->hdl);
> -             return ret;
> -     }
> +     if (ret < 0)
> +             goto fail;
>  #endif
>       /*
>        * We have checked empirically that hw allows to read back the gain
> @@ -1664,7 +1661,19 @@ static int ov7670_probe(struct i2c_client *client,
>       v4l2_ctrl_cluster(2, &info->saturation);
>       v4l2_ctrl_handler_setup(&info->hdl);
>  
> +     ret = v4l2_async_register_subdev(&info->sd);
> +     if (ret < 0) {
> +#if defined(CONFIG_MEDIA_CONTROLLER)
> +             media_entity_cleanup(&info->sd.entity);

I think it'd be cleaner if you added another label for this. Up to you.

Acked-by: Sakari Ailus <[email protected]>

> +#endif
> +             goto fail;
> +     }
> +
>       return 0;
> +
> +fail:
> +     v4l2_ctrl_handler_free(&info->hdl);
> +     return ret;
>  }
>  
>  

-- 
Sakari Ailus
e-mail: [email protected]     XMPP: [email protected]
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to