drm/via: reduce no need mutex_lock area
authorBernard Zhao <bernard@vivo.com>
Fri, 14 Aug 2020 08:30:19 +0000 (01:30 -0700)
committerSam Ravnborg <sam@ravnborg.org>
Sat, 17 Oct 2020 08:10:24 +0000 (10:10 +0200)
In function via_mem_alloc`s error branch, DRM_ERROR is protected
in the mutex_lock(&dev->struct_mutex) area.
>From the code, we see that DRM_ERROR is just an error log print
without any struct element, there is no need to protect this.

Signed-off-by: Bernard Zhao <bernard@vivo.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200814083021.8962-1-bernard@vivo.com
drivers/gpu/drm/via/via_mm.c

index 45cc9e90026012bd486cc0f1063921d195e069c4..dae1bacd86c1eacb72886b62da0ab2921c8963f0 100644 (file)
@@ -129,9 +129,9 @@ int via_mem_alloc(struct drm_device *dev, void *data,
        mutex_lock(&dev->struct_mutex);
        if (0 == ((mem->type == VIA_MEM_VIDEO) ? dev_priv->vram_initialized :
                      dev_priv->agp_initialized)) {
+               mutex_unlock(&dev->struct_mutex);
                DRM_ERROR
                    ("Attempt to allocate from uninitialized memory manager.\n");
-               mutex_unlock(&dev->struct_mutex);
                return -EINVAL;
        }