dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Haneen Mohammed <hamohammed.sa@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: hamohammed.sa@gmail.com, rodrigosiqueiramelo@gmail.com
Subject: [PATCH] drm/vkms: Release pages_lock before return
Date: Fri, 3 Aug 2018 23:11:42 +0300	[thread overview]
Message-ID: <20180803201142.GA2206@haneenDRM> (raw)

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

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

             reply	other threads:[~2018-08-03 20:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-03 20:11 Haneen Mohammed [this message]
2018-08-03 20:20 ` [PATCH] drm/vkms: Release pages_lock before return Sean Paul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180803201142.GA2206@haneenDRM \
    --to=hamohammed.sa@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=rodrigosiqueiramelo@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox