[PATCH] drm/vkms: Release pages_lock before return

Haneen Mohammed hamohammed.sa at gmail.com
Fri Aug 3 20:11:42 UTC 2018


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 at gmail.com>
---
 drivers/gpu/drm/vkms/vkms_crc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vkms/vkms_crc.c b/drivers/gpu/drm/vkms/vkms_crc.c
index 9b909221943f..37d717f38e3c 100644
--- a/drivers/gpu/drm/vkms/vkms_crc.c
+++ b/drivers/gpu/drm/vkms/vkms_crc.c
@@ -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;
 }
 
-- 
2.17.1



More information about the dri-devel mailing list