diff mbox series

drm/vkms: Release pages_lock before return

Message ID 20180803201142.GA2206@haneenDRM (mailing list archive)
State New, archived
Headers show
Series drm/vkms: Release pages_lock before return | expand

Commit Message

Haneen Mohammed Aug. 3, 2018, 8:11 p.m. UTC
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>
---
 drivers/gpu/drm/vkms/vkms_crc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

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;
 }