Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/riastradh-drm2]: src/sys/external/bsd/drm2/linux Helps to actually alloc...



details:   https://anonhg.NetBSD.org/src/rev/58b3058e7c90
branches:  riastradh-drm2
changeset: 788573:58b3058e7c90
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Dec 30 04:50:30 2013 +0000

description:
Helps to actually allocate and free the workqueue memory!

diffstat:

 sys/external/bsd/drm2/linux/linux_work.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (42 lines):

diff -r ff187a325c6c -r 58b3058e7c90 sys/external/bsd/drm2/linux/linux_work.c
--- a/sys/external/bsd/drm2/linux/linux_work.c  Mon Dec 30 04:50:21 2013 +0000
+++ b/sys/external/bsd/drm2/linux/linux_work.c  Mon Dec 30 04:50:30 2013 +0000
@@ -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 @@
 
        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 @@
 
        cv_destroy(&wq->wq_cv);
        mutex_destroy(&wq->wq_lock);
+
+       kmem_free(wq, sizeof(*wq));
 }
 
 /*



Home | Main Index | Thread Index | Old Index