[PATCH 8/8] drm/ast: Move SIL164-based connector code into separate helpers
Javier Martinez Canillas
javierm at redhat.com
Thu Feb 3 17:57:01 UTC 2022
On 1/11/22 13:00, Thomas Zimmermann wrote:
> Add helpers for initializing SIL164-based connectors. These used to be
> handled by the VGA connector code. But SIL164 provides output via DVI-I,
> so set the encoder and connector types accordingly.
>
> If a SIL164 chip has been detected, ast will now create a DVI-I
> connector instead of a VGA connector.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
> ---
> drivers/gpu/drm/ast/ast_drv.h | 15 ++++++
> drivers/gpu/drm/ast/ast_mode.c | 99 +++++++++++++++++++++++++++++++++-
> 2 files changed, 112 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h
> index 420d19d8459e..c3a582372649 100644
> --- a/drivers/gpu/drm/ast/ast_drv.h
> +++ b/drivers/gpu/drm/ast/ast_drv.h
> @@ -140,6 +140,17 @@ to_ast_vga_connector(struct drm_connector *connector)
> return container_of(connector, struct ast_vga_connector, base);
> }
>
[snip]
> +static int ast_sil164_connector_init(struct drm_device *dev,
> + struct ast_sil164_connector *ast_sil164_connector)
> +{
> + struct drm_connector *connector = &ast_sil164_connector->base;
> + int ret;
> +
> + ast_sil164_connector->i2c = ast_i2c_create(dev);
> + if (!ast_sil164_connector->i2c)
> + drm_err(dev, "failed to add ddc bus for connector\n");
> +
> + if (ast_sil164_connector->i2c)
> + ret = drm_connector_init_with_ddc(dev, connector, &ast_sil164_connector_funcs,
> + DRM_MODE_CONNECTOR_DVII,
> + &ast_sil164_connector->i2c->adapter);
> + else
> + ret = drm_connector_init(dev, connector, &ast_sil164_connector_funcs,
> + DRM_MODE_CONNECTOR_DVII);
> + if (ret)
I think you want a kfree(i2c) here before returning.
And where is the struct ast_i2c_chan freed if the function succeeds ?
With that,
Reviewed-by: Javier Martinez Canillas <javierm at redhat.com>
Best regards,
--
Javier Martinez Canillas
Linux Engineering
Red Hat
More information about the dri-devel
mailing list