Module Name:    src
Committed By:   riastradh
Date:           Mon Dec 30 04:50:30 UTC 2013

Modified Files:
        src/sys/external/bsd/drm2/linux [riastradh-drm2]: linux_work.c

Log Message:
Helps to actually allocate and free the workqueue memory!


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/external/bsd/drm2/linux/linux_work.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/linux/linux_work.c
diff -u src/sys/external/bsd/drm2/linux/linux_work.c:1.1.2.2 src/sys/external/bsd/drm2/linux/linux_work.c:1.1.2.3
--- src/sys/external/bsd/drm2/linux/linux_work.c:1.1.2.2	Mon Dec 30 04:50:21 2013
+++ src/sys/external/bsd/drm2/linux/linux_work.c	Mon Dec 30 04:50:30 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_work.c,v 1.1.2.2 2013/12/30 04:50:21 riastradh Exp $	*/
+/*	$NetBSD: linux_work.c,v 1.1.2.3 2013/12/30 04:50:30 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.1.2.2 2013/12/30 04:50:21 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.1.2.3 2013/12/30 04:50:30 riastradh Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -114,10 +114,13 @@ alloc_ordered_workqueue(const char *name
 
 	KASSERT(linux_flags == 0);
 
+	wq = kmem_alloc(sizeof(*wq), KM_SLEEP);
 	error = workqueue_create(&wq->wq_workqueue, name, &linux_worker,
 	    NULL, PRI_NONE, IPL_NONE, flags);
-	if (error)
+	if (error) {
+		kmem_free(wq, sizeof(*wq));
 		return NULL;
+	}
 
 	mutex_init(&wq->wq_lock, MUTEX_DEFAULT, IPL_NONE);
 	cv_init(&wq->wq_cv, name);
@@ -163,6 +166,8 @@ destroy_workqueue(struct workqueue_struc
 
 	cv_destroy(&wq->wq_cv);
 	mutex_destroy(&wq->wq_lock);
+
+	kmem_free(wq, sizeof(*wq));
 }
 
 /*

Reply via email to