[PATCH] vmwgfx: add missing mutex_unlocks

Devendra Naga develkernel412222 at gmail.com
Fri Aug 3 22:33:40 PDT 2012


we have done a proper mutex_unlock in the error cases of the vmw_fifo_reserve, but
there are missing mutex unlocks where we return a valid pointer in vmw_fifo_reserve.

Signed-off-by: Devendra Naga <develkernel412222 at gmail.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
index a0c2f12..e3abd7a 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
@@ -355,6 +355,7 @@ void *vmw_fifo_reserve(struct vmw_private *dev_priv, uint32_t bytes)
 				if (reserveable)
 					iowrite32(bytes, fifo_mem +
 						  SVGA_FIFO_RESERVED);
+				mutex_unlock(&fifo_state->fifo_mutex);
 				return fifo_mem + (next_cmd >> 2);
 			} else {
 				need_bounce = true;
@@ -363,10 +364,12 @@ void *vmw_fifo_reserve(struct vmw_private *dev_priv, uint32_t bytes)
 
 		if (need_bounce) {
 			fifo_state->using_bounce_buffer = true;
-			if (bytes < fifo_state->static_buffer_size)
+			if (bytes < fifo_state->static_buffer_size) {
+				mutex_unlock(&fifo_state->fifo_mutex);
 				return fifo_state->static_buffer;
-			else {
+			} else {
 				fifo_state->dynamic_buffer = vmalloc(bytes);
+				mutex_unlock(&fifo_state->fifo_mutex);
 				return fifo_state->dynamic_buffer;
 			}
 		}
-- 
1.7.9.5



More information about the dri-devel mailing list