[PATCH] drm: writeback: Fix drm_writeback_connector_cleanup signature

Louis Chauvet posted 1 patch 7 months, 3 weeks ago
There is a newer version of this series
drivers/gpu/drm/drm_writeback.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
[PATCH] drm: writeback: Fix drm_writeback_connector_cleanup signature
Posted by Louis Chauvet 7 months, 3 weeks ago
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>
Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
---
 drivers/gpu/drm/drm_writeback.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_writeback.c b/drivers/gpu/drm/drm_writeback.c
index edbeab88ff2b..2f5c40616d9d 100644
--- a/drivers/gpu/drm/drm_writeback.c
+++ b/drivers/gpu/drm/drm_writeback.c
@@ -350,10 +350,11 @@ EXPORT_SYMBOL(drm_writeback_connector_init_with_encoder);
  * 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);
@@ -405,7 +406,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;

---
base-commit: b848cd418aebdb313364b4843f41fae82281a823
change-id: 20250428-drm-fix-writeback-cleanup-a1179f3b9691

Best regards,
-- 
Louis Chauvet <louis.chauvet@bootlin.com>
Re: [PATCH] drm: writeback: Fix drm_writeback_connector_cleanup signature
Posted by kernel test robot 7 months, 3 weeks ago
Hi Louis,

kernel test robot noticed the following build warnings:

[auto build test WARNING on b848cd418aebdb313364b4843f41fae82281a823]

url:    https://github.com/intel-lab-lkp/linux/commits/Louis-Chauvet/drm-writeback-Fix-drm_writeback_connector_cleanup-signature/20250428-163254
base:   b848cd418aebdb313364b4843f41fae82281a823
patch link:    https://lore.kernel.org/r/20250428-drm-fix-writeback-cleanup-v1-1-e4c723868b73%40bootlin.com
patch subject: [PATCH] drm: writeback: Fix drm_writeback_connector_cleanup signature
config: arm-randconfig-002-20250428 (https://download.01.org/0day-ci/archive/20250429/202504290021.ZR6XX2Sc-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 7.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250429/202504290021.ZR6XX2Sc-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202504290021.ZR6XX2Sc-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/drm_writeback.c:354: warning: Function parameter or struct member 'data' not described in 'drm_writeback_connector_cleanup'
>> drivers/gpu/drm/drm_writeback.c:354: warning: Excess function parameter 'wb_connector' description in 'drm_writeback_connector_cleanup'


vim +354 drivers/gpu/drm/drm_writeback.c

935774cd71fe60 Brian Starkey 2017-03-29  342  
1914ba2b91ea8e Louis Chauvet 2025-01-16  343  /**
1914ba2b91ea8e Louis Chauvet 2025-01-16  344   * drm_writeback_connector_cleanup - Cleanup the writeback connector
1914ba2b91ea8e Louis Chauvet 2025-01-16  345   * @dev: DRM device
1914ba2b91ea8e Louis Chauvet 2025-01-16  346   * @wb_connector: Pointer to the writeback connector to clean up
1914ba2b91ea8e Louis Chauvet 2025-01-16  347   *
1914ba2b91ea8e Louis Chauvet 2025-01-16  348   * This will decrement the reference counter of blobs and destroy properties. It
1914ba2b91ea8e Louis Chauvet 2025-01-16  349   * will also clean the remaining jobs in this writeback connector. Caution: This helper will not
1914ba2b91ea8e Louis Chauvet 2025-01-16  350   * clean up the attached encoder and the drm_connector.
1914ba2b91ea8e Louis Chauvet 2025-01-16  351   */
1914ba2b91ea8e Louis Chauvet 2025-01-16  352  static void drm_writeback_connector_cleanup(struct drm_device *dev,
928d313d023526 Louis Chauvet 2025-04-28  353  					    void *data)
1914ba2b91ea8e Louis Chauvet 2025-01-16 @354  {
1914ba2b91ea8e Louis Chauvet 2025-01-16  355  	unsigned long flags;
1914ba2b91ea8e Louis Chauvet 2025-01-16  356  	struct drm_writeback_job *pos, *n;
928d313d023526 Louis Chauvet 2025-04-28  357  	struct drm_writeback_connector *wb_connector = data;
1914ba2b91ea8e Louis Chauvet 2025-01-16  358  
1914ba2b91ea8e Louis Chauvet 2025-01-16  359  	delete_writeback_properties(dev);
1914ba2b91ea8e Louis Chauvet 2025-01-16  360  	drm_property_blob_put(wb_connector->pixel_formats_blob_ptr);
1914ba2b91ea8e Louis Chauvet 2025-01-16  361  
1914ba2b91ea8e Louis Chauvet 2025-01-16  362  	spin_lock_irqsave(&wb_connector->job_lock, flags);
1914ba2b91ea8e Louis Chauvet 2025-01-16  363  	list_for_each_entry_safe(pos, n, &wb_connector->job_queue, list_entry) {
1914ba2b91ea8e Louis Chauvet 2025-01-16  364  		list_del(&pos->list_entry);
ff3881cc6a588f Dan Carpenter 2025-02-12  365  		drm_writeback_cleanup_job(pos);
1914ba2b91ea8e Louis Chauvet 2025-01-16  366  	}
1914ba2b91ea8e Louis Chauvet 2025-01-16  367  	spin_unlock_irqrestore(&wb_connector->job_lock, flags);
1914ba2b91ea8e Louis Chauvet 2025-01-16  368  }
1914ba2b91ea8e Louis Chauvet 2025-01-16  369  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki