[PATCH v4 03/11] drm/xe/configfs: Destroy xe_configfs.su_mutex on exit/error

Rodrigo Vivi rodrigo.vivi at intel.com
Mon Jul 28 19:42:14 UTC 2025


On Sun, Jul 27, 2025 at 07:20:00PM +0200, Michal Wajdeczko wrote:
> While mutex_destroy() is NOP when CONFIG_DEBUG_MUTEXES is not
> enabled, we should still call it.
> 
> While around, simplify init() code as there is no need to print
> separate error message, nor have a temporary variable, which was
> likely just taken from the example code. And drop a traling line.

The temporary variable was good while used in the pr_err to minimize
the line size. But I agree it has to go with the pr_err removed.
But perhaps 2 separate patches here? one for the mutex destroy
and one for the pr_err removal?

> 
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
> Cc: Lucas De Marchi <lucas.demarchi at intel.com>
> ---
>  drivers/gpu/drm/xe/xe_configfs.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_configfs.c b/drivers/gpu/drm/xe/xe_configfs.c
> index 36e2b45b305f..6aa0531bcf76 100644
> --- a/drivers/gpu/drm/xe/xe_configfs.c
> +++ b/drivers/gpu/drm/xe/xe_configfs.c
> @@ -392,15 +392,13 @@ u64 xe_configfs_get_engines_allowed(struct pci_dev *pdev)
>  
>  int __init xe_configfs_init(void)
>  {
> -	struct config_group *root = &xe_configfs.su_group;
>  	int ret;
>  
> -	config_group_init(root);
> +	config_group_init(&xe_configfs.su_group);
>  	mutex_init(&xe_configfs.su_mutex);
>  	ret = configfs_register_subsystem(&xe_configfs);
>  	if (ret) {
> -		pr_err("Error %d while registering %s subsystem\n",
> -		       ret, root->cg_item.ci_namebuf);
> +		mutex_destroy(&xe_configfs.su_mutex);
>  		return ret;
>  	}
>  
> @@ -410,5 +408,5 @@ int __init xe_configfs_init(void)
>  void __exit xe_configfs_exit(void)
>  {
>  	configfs_unregister_subsystem(&xe_configfs);
> +	mutex_destroy(&xe_configfs.su_mutex);
>  }
> -
> -- 
> 2.47.1
> 


More information about the Intel-xe mailing list