* [PATCH RESEND] drm/connector: check if destroy function exist
@ 2026-07-02 19:14 Andreas Kemnade
2026-07-03 7:09 ` Thomas Zimmermann
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Kemnade @ 2026-07-02 19:14 UTC (permalink / raw)
To: maarten.lankhorst, mripard, tzimmermann, airlied, simona, lumag,
dri-devel, linux-kernel
Cc: 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")
Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
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);
}
}
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH RESEND] drm/connector: check if destroy function exist
2026-07-02 19:14 [PATCH RESEND] drm/connector: check if destroy function exist Andreas Kemnade
@ 2026-07-03 7:09 ` Thomas Zimmermann
2026-07-28 18:36 ` Andreas Kemnade
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Zimmermann @ 2026-07-03 7:09 UTC (permalink / raw)
To: Andreas Kemnade, maarten.lankhorst, mripard, airlied, simona,
lumag, dri-devel, linux-kernel
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.
Best regards
Thomas
> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> ---
> 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)
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH RESEND] drm/connector: check if destroy function exist
2026-07-03 7:09 ` Thomas Zimmermann
@ 2026-07-28 18:36 ` Andreas Kemnade
0 siblings, 0 replies; 3+ messages in thread
From: Andreas Kemnade @ 2026-07-28 18:36 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: maarten.lankhorst, mripard, airlied, simona, lumag, dri-devel,
linux-kernel
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@kemnade.info>
> > ---
> > 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)
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-29 6:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-02 19:14 [PATCH RESEND] drm/connector: check if destroy function exist Andreas Kemnade
2026-07-03 7:09 ` Thomas Zimmermann
2026-07-28 18:36 ` Andreas Kemnade
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox