Re: [PATCH RESEND] drm/connector: check if destroy function exist
From: Andreas Kemnade
Date: Wed Jul 29 2026 - 02:50:24 EST
On Fri, Jul 03, 2026 at 09:09:46AM +0200, Thomas Zimmermann wrote:
> Hi
>
> Am 02.07.26 um 21:14 schrieb Andreas Kemnade:
> > Connectors might have not resources needed to be manually freed.
> > E.g. the drm_bridge_connector does not have such a callback.
> >
> > Fixes: c12907be57b1 ("drm/bridge-connector: switch to using drmm allocations")
>
> This patch uses drmm_connector_init() for the cleanup, which is a mis-design
> IMHO. Rather than calling drm_connector_cleanup(), it should call
> connector->funcs->destroy, which then points to drm_connector_cleanup. This
> would make the whole thing more useful and not require fixups (like this
> one) elsewhere in the code. Just just my 2cts.
>
That just sounds like a revert to me. But maybe I misunterstand your comment
> Best regards
> Thomas
>
>
> > Signed-off-by: Andreas Kemnade <andreas@xxxxxxxxxxxx>
> > ---
> > drivers/gpu/drm/drm_connector.c | 8 ++++++--
> > 1 file changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> > index 47dc53c4a738..d2dfc6e8f7d0 100644
> > --- a/drivers/gpu/drm/drm_connector.c
> > +++ b/drivers/gpu/drm/drm_connector.c
> > @@ -198,7 +198,9 @@ static void drm_connector_free(struct kref *kref)
> > struct drm_device *dev = connector->dev;
> > drm_mode_object_unregister(dev, &connector->base);
> > - connector->funcs->destroy(connector);
> > +
> > + if (connector->funcs->destroy)
> > + connector->funcs->destroy(connector);
> > }
> > void drm_connector_free_work_fn(struct work_struct *work)
> > @@ -216,7 +218,9 @@ void drm_connector_free_work_fn(struct work_struct *work)
> > llist_for_each_entry_safe(connector, n, freed, free_node) {
> > drm_mode_object_unregister(dev, &connector->base);
> > - connector->funcs->destroy(connector);
> > +
> > + if (connector->funcs->destroy)
> > + connector->funcs->destroy(connector);
> > }
> > }
>
> --
> --
> Thomas Zimmermann
> Graphics Driver Developer
> SUSE Software Solutions Germany GmbH
> Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
> GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
>
>
>