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/include/linux Fix sense of at...



details:   https://anonhg.NetBSD.org/src/rev/3e34bdf33e8f
branches:  riastradh-drm2
changeset: 788505:3e34bdf33e8f
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Sep 08 15:33:35 2013 +0000

description:
Fix sense of atomic_cas loop condition and use kassertmsg for krefs.

diffstat:

 sys/external/bsd/drm2/include/linux/kref.h |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (31 lines):

diff -r 4cbd6b3c565b -r 3e34bdf33e8f sys/external/bsd/drm2/include/linux/kref.h
--- a/sys/external/bsd/drm2/include/linux/kref.h        Sun Sep 08 15:33:06 2013 +0000
+++ b/sys/external/bsd/drm2/include/linux/kref.h        Sun Sep 08 15:33:35 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kref.h,v 1.1.2.2 2013/07/24 01:51:36 riastradh Exp $   */
+/*     $NetBSD: kref.h,v 1.1.2.3 2013/09/08 15:33:35 riastradh Exp $   */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
        const unsigned int count __unused =
            atomic_inc_uint_nv(&kref->kr_count);
 
-       KASSERT(count > 1);
+       KASSERTMSG((count > 1), "getting released kref");
 }
 
 static inline int
@@ -64,9 +64,10 @@
 
        do {
                old = kref->kr_count;
-               KASSERT(count <= old);
+               KASSERTMSG((count <= old), "overreleasing kref: %u - %u",
+                   old, count);
                new = (old - count);
-       } while (atomic_cas_uint(&kref->kr_count, old, new) == old);
+       } while (atomic_cas_uint(&kref->kr_count, old, new) != old);
 
        if (new == 0) {
                (*release)(kref);



Home | Main Index | Thread Index | Old Index