On Wed, 29 Jun 2022, Maxime Ripard <maxime@xxxxxxxxxx> wrote: > Connectors need to be cleaned up with a call to drm_connector_cleanup() > in their drm_connector_funcs.destroy implementation. > > Let's check for this and complain if there's no such function. > > Signed-off-by: Maxime Ripard <maxime@xxxxxxxxxx> > --- > drivers/gpu/drm/drm_connector.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c > index d7dab4242290..855267116e68 100644 > --- a/drivers/gpu/drm/drm_connector.c > +++ b/drivers/gpu/drm/drm_connector.c > @@ -347,6 +347,9 @@ int drm_connector_init(struct drm_device *dev, > const struct drm_connector_funcs *funcs, > int connector_type) > { > + if (WARN_ON(!(funcs && funcs->destroy))) drm_WARN_ON() for both. > + return -EINVAL; > + > return __drm_connector_init(dev, connector, funcs, connector_type, NULL); > } > EXPORT_SYMBOL(drm_connector_init); > @@ -377,6 +380,9 @@ int drm_connector_init_with_ddc(struct drm_device *dev, > int connector_type, > struct i2c_adapter *ddc) > { > + if (WARN_ON(!(funcs && funcs->destroy))) > + return -EINVAL; > + > return __drm_connector_init(dev, connector, funcs, connector_type, ddc); > } > EXPORT_SYMBOL(drm_connector_init_with_ddc); -- Jani Nikula, Intel Open Source Graphics Center