drm/vkms: Release pages_lock before return
authorHaneen Mohammed <hamohammed.sa@gmail.com>
Fri, 3 Aug 2018 20:11:42 +0000 (23:11 +0300)
committerSean Paul <seanpaul@chromium.org>
Fri, 3 Aug 2018 20:14:56 +0000 (16:14 -0400)
Release pages_lock before return when vkms_obj->vaddr is NULL.
This patch fixes: 6c234fe37c57 ("drm/vkms: Implement CRC debugfs API").

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180803201142.GA2206@haneenDRM
drivers/gpu/drm/vkms/vkms_crc.c

index 9b909221943fe27eba780c20b04d3ff3031edbf4..37d717f38e3c14b959d978c7c3fc4f1b331b46a7 100644 (file)
@@ -22,14 +22,15 @@ static uint32_t _vkms_get_crc(struct vkms_crc_data *crc_data)
        mutex_lock(&vkms_obj->pages_lock);
        vaddr = vkms_obj->vaddr;
        if (WARN_ON(!vaddr))
-               return crc;
+               goto out;
 
        for (i = y; i < y + height; i++) {
                src_offset = fb->offsets[0] + (i * fb->pitches[0]) + (x * cpp);
                crc = crc32_le(crc, vaddr + src_offset, size_byte);
        }
-       mutex_unlock(&vkms_obj->pages_lock);
 
+out:
+       mutex_unlock(&vkms_obj->pages_lock);
        return crc;
 }