patch-2.4.6 linux/drivers/char/drm/context.c

Next file: linux/drivers/char/drm/dma.c
Previous file: linux/drivers/char/drm/agpsupport.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.5/linux/drivers/char/drm/context.c linux/drivers/char/drm/context.c
@@ -91,10 +91,13 @@
 		atomic_dec(&dev->queuelist[i]->use_count);
 	}
 				/* Allocate a new queue */
-	down(&dev->struct_sem);
 	
 	queue = drm_alloc(sizeof(*queue), DRM_MEM_QUEUES);
+	if(queue == NULL)
+		return -ENOMEM;	
+
 	memset(queue, 0, sizeof(*queue));
+	down(&dev->struct_sem);
 	atomic_set(&queue->use_count, 1);
 	
 	++dev->queue_count;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)