Re: [PATCH 11/62] drm/pagemap: Unlock cache->lock before freeing it

From: Matthew Brost

Date: Mon Feb 23 2026 - 17:23:31 EST


On Mon, Feb 23, 2026 at 02:00:11PM -0800, Bart Van Assche wrote:
> From: Bart Van Assche <bvanassche@xxxxxxx>
>
> Although freeing a spinlock without unlocking it is fine, this confuses

Fine, but pretty bad practice.

> static analyzers. Hence this patch.
>
> Cc: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
> Cc: Maxime Ripard <mripard@xxxxxxxxxx>
> Cc: Thomas Zimmermann <tzimmermann@xxxxxxx>
> Cc: Thomas Hellström <thomas.hellstrom@xxxxxxxxxxxxxxx>
> Cc: Matthew Brost <matthew.brost@xxxxxxxxx>

With that:
Reviewed-by: Matthew Brost <matthew.brost@xxxxxxxxx>

We can apply this to the DRM branches and propagate this up to Linus
during 7.0 cycle if that works for you? Or if you have other plans to
merge, let us know.

Matt

> Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
> ---
> drivers/gpu/drm/drm_pagemap_util.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_pagemap_util.c b/drivers/gpu/drm/drm_pagemap_util.c
> index 14ddb948a32e..50cb5f9cdac5 100644
> --- a/drivers/gpu/drm/drm_pagemap_util.c
> +++ b/drivers/gpu/drm/drm_pagemap_util.c
> @@ -74,6 +74,8 @@ static void drm_pagemap_cache_fini(void *arg)
> cache->dpagemap = NULL;
> spin_unlock(&cache->lock);
> drm_pagemap_destroy(dpagemap, false);
> + } else {
> + spin_unlock(&cache->lock);
> }
>
> out: