Skip to content

Commit a961b19

Browse files
committed
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: Thomas Zimmermann <[email protected]> Signed-off-by: Maxime Ripard <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent b11af8a commit a961b19

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/gpu/drm/drm_connector.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,9 @@ int drm_connector_init(struct drm_device *dev,
348348
const struct drm_connector_funcs *funcs,
349349
int connector_type)
350350
{
351+
if (drm_WARN_ON(dev, !(funcs && funcs->destroy)))
352+
return -EINVAL;
353+
351354
return __drm_connector_init(dev, connector, funcs, connector_type, NULL);
352355
}
353356
EXPORT_SYMBOL(drm_connector_init);
@@ -378,6 +381,9 @@ int drm_connector_init_with_ddc(struct drm_device *dev,
378381
int connector_type,
379382
struct i2c_adapter *ddc)
380383
{
384+
if (drm_WARN_ON(dev, !(funcs && funcs->destroy)))
385+
return -EINVAL;
386+
381387
return __drm_connector_init(dev, connector, funcs, connector_type, ddc);
382388
}
383389
EXPORT_SYMBOL(drm_connector_init_with_ddc);

0 commit comments

Comments
 (0)