UPSTREAM: drm: writeback: Fix drm_writeback_connector_cleanup signature

The drm_writeback_connector_cleanup have the signature:

     static void drm_writeback_connector_cleanup(
		struct drm_device *dev,
		struct drm_writeback_connector *wb_connector)

But it is stored and used as a drmres_release_t

    typedef void (*drmres_release_t)(struct drm_device *dev, void *res);

While the current code is valid and does not produce any warning, the
CFI runtime check (CONFIG_CFI_CLANG) can fail because the function
signature is not the same as drmres_release_t.

In order to fix this, change the function signature to match what is
expected by drmres_release_t.

Fixes: 1914ba2b91ea ("drm: writeback: Create drmm variants for drm_writeback_connector initialization")

Suggested-by: Mark Yacoub <markyacoub@google.com>
Reviewed-by: Maíra Canal <mcanal@igalia.com>
Link: https://lore.kernel.org/r/20250429-drm-fix-writeback-cleanup-v2-1-548ff3a4e284@bootlin.com
Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
(cherry picked from commit fb721b2c35b1829b8ecf62e3adb41cf30260316a)

Bug: 412666164
Test: Disabling VKMS while in-use should not crash
Change-Id: Id1770ae460fb20f972fbc60c701483b30f913c19
Signed-off-by: Michael Pobega <pobega@google.com>
This commit is contained in:
Louis Chauvet
2025-04-29 10:36:23 +02:00
committed by Treehugger Robot
parent 82154090df
commit 78c6c49396
+4 -3
View File
@@ -349,17 +349,18 @@ EXPORT_SYMBOL(drm_writeback_connector_init_with_encoder);
/**
* drm_writeback_connector_cleanup - Cleanup the writeback connector
* @dev: DRM device
* @wb_connector: Pointer to the writeback connector to clean up
* @data: Pointer to the writeback connector to clean up
*
* This will decrement the reference counter of blobs and destroy properties. It
* will also clean the remaining jobs in this writeback connector. Caution: This helper will not
* clean up the attached encoder and the drm_connector.
*/
static void drm_writeback_connector_cleanup(struct drm_device *dev,
struct drm_writeback_connector *wb_connector)
void *data)
{
unsigned long flags;
struct drm_writeback_job *pos, *n;
struct drm_writeback_connector *wb_connector = data;
delete_writeback_properties(dev);
drm_property_blob_put(wb_connector->pixel_formats_blob_ptr);
@@ -411,7 +412,7 @@ int drmm_writeback_connector_init(struct drm_device *dev,
if (ret)
return ret;
ret = drmm_add_action_or_reset(dev, (void *)drm_writeback_connector_cleanup,
ret = drmm_add_action_or_reset(dev, drm_writeback_connector_cleanup,
wb_connector);
if (ret)
return ret;