Re: [PATCH v5 4/8] drm/mali: use drmm_writeback_connector_init()
From: Liviu Dudau
Date: Tue Jun 02 2026 - 06:45:06 EST
On Tue, May 05, 2026 at 03:25:01AM +0300, Dmitry Baryshkov wrote:
> The driver uses drm_writeback_connector_init() instead of its drmm
> counterpart, but it doesn't perform the job queue cleanup (neither
> manually nor by calling drm_writeback_connector_cleanup()). On the
> contrary, the drmm_writeback_connector_init() function ensures the
> proper cleanup of the job queue.
>
> Use drmm_plain_encoder_alloc() to allocate simple encoder and
> drmm_writeback_connector_init() in order to initialize writeback
> connector instance.
>
> Reviewed-by: Suraj Kandpal <suraj.kandpal@xxxxxxxxx>
> Reviewed-by: Louis Chauvet <louis.chauvet@xxxxxxxxxxx>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxxxxxxxx>
Reviewed-by: Liviu Dudau <liviu.dudau@xxxxxxx>
Best regards,
Liviu
> ---
> drivers/gpu/drm/arm/malidp_mw.c | 25 ++++++++++++++-----------
> 1 file changed, 14 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/arm/malidp_mw.c b/drivers/gpu/drm/arm/malidp_mw.c
> index fad343842038..6e0c78e998aa 100644
> --- a/drivers/gpu/drm/arm/malidp_mw.c
> +++ b/drivers/gpu/drm/arm/malidp_mw.c
> @@ -84,11 +84,6 @@ malidp_mw_connector_detect(struct drm_connector *connector, bool force)
> return connector_status_connected;
> }
>
> -static void malidp_mw_connector_destroy(struct drm_connector *connector)
> -{
> - drm_connector_cleanup(connector);
> -}
> -
> static struct drm_connector_state *
> malidp_mw_connector_duplicate_state(struct drm_connector *connector)
> {
> @@ -114,7 +109,6 @@ static const struct drm_connector_funcs malidp_mw_connector_funcs = {
> .reset = malidp_mw_connector_reset,
> .detect = malidp_mw_connector_detect,
> .fill_modes = drm_helper_probe_single_connector_modes,
> - .destroy = malidp_mw_connector_destroy,
> .atomic_duplicate_state = malidp_mw_connector_duplicate_state,
> .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
> };
> @@ -211,6 +205,7 @@ static u32 *get_writeback_formats(struct malidp_drm *malidp, int *n_formats)
> int malidp_mw_connector_init(struct drm_device *drm)
> {
> struct malidp_drm *malidp = drm_to_malidp(drm);
> + struct drm_encoder *encoder;
> u32 *formats;
> int ret, n_formats;
>
> @@ -224,11 +219,19 @@ int malidp_mw_connector_init(struct drm_device *drm)
> if (!formats)
> return -ENOMEM;
>
> - ret = drm_writeback_connector_init(drm, &malidp->mw_connector,
> - &malidp_mw_connector_funcs,
> - &malidp_mw_encoder_helper_funcs,
> - formats, n_formats,
> - 1 << drm_crtc_index(&malidp->crtc));
> + encoder = drmm_plain_encoder_alloc(drm, NULL, DRM_MODE_ENCODER_VIRTUAL,
> + NULL);
> + if (IS_ERR(encoder))
> + return PTR_ERR(encoder);
> +
> + drm_encoder_helper_add(encoder, &malidp_mw_encoder_helper_funcs);
> +
> + encoder->possible_crtcs = drm_crtc_mask(&malidp->crtc);
> +
> + ret = drmm_writeback_connector_init(drm, &malidp->mw_connector,
> + &malidp_mw_connector_funcs,
> + encoder,
> + formats, n_formats);
> kfree(formats);
> if (ret)
> return ret;
>
> --
> 2.47.3
>
--
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯