Commit a961b197 authored by Maxime Ripard's avatar Maxime Ripard

drm/connector: Check for destroy implementation

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.
Acked-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20220711173939.1132294-9-maxime@cerno.tech
parent b11af8a2
...@@ -348,6 +348,9 @@ int drm_connector_init(struct drm_device *dev, ...@@ -348,6 +348,9 @@ int drm_connector_init(struct drm_device *dev,
const struct drm_connector_funcs *funcs, const struct drm_connector_funcs *funcs,
int connector_type) int connector_type)
{ {
if (drm_WARN_ON(dev, !(funcs && funcs->destroy)))
return -EINVAL;
return __drm_connector_init(dev, connector, funcs, connector_type, NULL); return __drm_connector_init(dev, connector, funcs, connector_type, NULL);
} }
EXPORT_SYMBOL(drm_connector_init); EXPORT_SYMBOL(drm_connector_init);
...@@ -378,6 +381,9 @@ int drm_connector_init_with_ddc(struct drm_device *dev, ...@@ -378,6 +381,9 @@ int drm_connector_init_with_ddc(struct drm_device *dev,
int connector_type, int connector_type,
struct i2c_adapter *ddc) struct i2c_adapter *ddc)
{ {
if (drm_WARN_ON(dev, !(funcs && funcs->destroy)))
return -EINVAL;
return __drm_connector_init(dev, connector, funcs, connector_type, ddc); return __drm_connector_init(dev, connector, funcs, connector_type, ddc);
} }
EXPORT_SYMBOL(drm_connector_init_with_ddc); EXPORT_SYMBOL(drm_connector_init_with_ddc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment