* [PATCH] drm/panthor: Check debugfs GEM lock initialization
@ 2026-07-13 8:29 Linmao Li
2026-07-15 12:15 ` Liviu Dudau
2026-07-15 12:40 ` Adrián Larumbe
0 siblings, 2 replies; 3+ messages in thread
From: Linmao Li @ 2026-07-13 8:29 UTC (permalink / raw)
To: Boris Brezillon, Steven Price, Liviu Dudau
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Adrián Larumbe, dri-devel, linux-kernel,
Linmao Li
drmm_mutex_init() can fail while registering the managed cleanup action.
When that happens, drmm_add_action_or_reset() destroys the mutex before
returning the error. Continuing initialization would therefore leave the
debugfs GEM object list with an unusable lock.
Propagate the error as is already done for the other managed mutexes in
panthor_device_init().
Fixes: a3707f53eb3f ("drm/panthor: show device-wide list of DRM GEM objects over DebugFS")
Signed-off-by: Linmao Li <lilinmao@kylinos.cn>
---
drivers/gpu/drm/panthor/panthor_device.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/panthor/panthor_device.c b/drivers/gpu/drm/panthor/panthor_device.c
index 0b25abebb803..9687c59de350 100644
--- a/drivers/gpu/drm/panthor/panthor_device.c
+++ b/drivers/gpu/drm/panthor/panthor_device.c
@@ -182,7 +182,10 @@ int panthor_device_init(struct panthor_device *ptdev)
return ret;
#ifdef CONFIG_DEBUG_FS
- drmm_mutex_init(&ptdev->base, &ptdev->gems.lock);
+ ret = drmm_mutex_init(&ptdev->base, &ptdev->gems.lock);
+ if (ret)
+ return ret;
+
INIT_LIST_HEAD(&ptdev->gems.node);
#endif
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/panthor: Check debugfs GEM lock initialization
2026-07-13 8:29 [PATCH] drm/panthor: Check debugfs GEM lock initialization Linmao Li
@ 2026-07-15 12:15 ` Liviu Dudau
2026-07-15 12:40 ` Adrián Larumbe
1 sibling, 0 replies; 3+ messages in thread
From: Liviu Dudau @ 2026-07-15 12:15 UTC (permalink / raw)
To: Linmao Li
Cc: Boris Brezillon, Steven Price, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter,
Adrián Larumbe, dri-devel, linux-kernel
On Mon, Jul 13, 2026 at 04:29:12PM +0800, Linmao Li wrote:
> drmm_mutex_init() can fail while registering the managed cleanup action.
> When that happens, drmm_add_action_or_reset() destroys the mutex before
> returning the error. Continuing initialization would therefore leave the
> debugfs GEM object list with an unusable lock.
>
> Propagate the error as is already done for the other managed mutexes in
> panthor_device_init().
>
> Fixes: a3707f53eb3f ("drm/panthor: show device-wide list of DRM GEM objects over DebugFS")
> Signed-off-by: Linmao Li <lilinmao@kylinos.cn>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Best regards,
Liviu
> ---
> drivers/gpu/drm/panthor/panthor_device.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_device.c b/drivers/gpu/drm/panthor/panthor_device.c
> index 0b25abebb803..9687c59de350 100644
> --- a/drivers/gpu/drm/panthor/panthor_device.c
> +++ b/drivers/gpu/drm/panthor/panthor_device.c
> @@ -182,7 +182,10 @@ int panthor_device_init(struct panthor_device *ptdev)
> return ret;
>
> #ifdef CONFIG_DEBUG_FS
> - drmm_mutex_init(&ptdev->base, &ptdev->gems.lock);
> + ret = drmm_mutex_init(&ptdev->base, &ptdev->gems.lock);
> + if (ret)
> + return ret;
> +
> INIT_LIST_HEAD(&ptdev->gems.node);
> #endif
>
> --
> 2.25.1
>
--
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/panthor: Check debugfs GEM lock initialization
2026-07-13 8:29 [PATCH] drm/panthor: Check debugfs GEM lock initialization Linmao Li
2026-07-15 12:15 ` Liviu Dudau
@ 2026-07-15 12:40 ` Adrián Larumbe
1 sibling, 0 replies; 3+ messages in thread
From: Adrián Larumbe @ 2026-07-15 12:40 UTC (permalink / raw)
To: Linmao Li
Cc: Boris Brezillon, Steven Price, Liviu Dudau, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
dri-devel, linux-kernel
Reviewed-by: Adrián Larumbe <adrian.larumbe@collabora.com>
On 13.07.2026 16:29, Linmao Li wrote:
> drmm_mutex_init() can fail while registering the managed cleanup action.
> When that happens, drmm_add_action_or_reset() destroys the mutex before
> returning the error. Continuing initialization would therefore leave the
> debugfs GEM object list with an unusable lock.
>
> Propagate the error as is already done for the other managed mutexes in
> panthor_device_init().
>
> Fixes: a3707f53eb3f ("drm/panthor: show device-wide list of DRM GEM objects over DebugFS")
> Signed-off-by: Linmao Li <lilinmao@kylinos.cn>
> ---
> drivers/gpu/drm/panthor/panthor_device.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_device.c b/drivers/gpu/drm/panthor/panthor_device.c
> index 0b25abebb803..9687c59de350 100644
> --- a/drivers/gpu/drm/panthor/panthor_device.c
> +++ b/drivers/gpu/drm/panthor/panthor_device.c
> @@ -182,7 +182,10 @@ int panthor_device_init(struct panthor_device *ptdev)
> return ret;
>
> #ifdef CONFIG_DEBUG_FS
> - drmm_mutex_init(&ptdev->base, &ptdev->gems.lock);
> + ret = drmm_mutex_init(&ptdev->base, &ptdev->gems.lock);
> + if (ret)
> + return ret;
> +
> INIT_LIST_HEAD(&ptdev->gems.node);
> #endif
>
> --
> 2.25.1
>
Adrian Larumbe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-15 12:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-13 8:29 [PATCH] drm/panthor: Check debugfs GEM lock initialization Linmao Li
2026-07-15 12:15 ` Liviu Dudau
2026-07-15 12:40 ` Adrián Larumbe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox