aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/kref.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/lib/kref.c b/lib/kref.c
index 4a467faf1367..0d07cc31c818 100644
--- a/lib/kref.c
+++ b/lib/kref.c
@@ -52,12 +52,7 @@ int kref_put(struct kref *kref, void (*release)(struct kref *kref))
52 WARN_ON(release == NULL); 52 WARN_ON(release == NULL);
53 WARN_ON(release == (void (*)(struct kref *))kfree); 53 WARN_ON(release == (void (*)(struct kref *))kfree);
54 54
55 /* 55 if (atomic_dec_and_test(&kref->refcount)) {
56 * if current count is one, we are the last user and can release object
57 * right now, avoiding an atomic operation on 'refcount'
58 */
59 if ((atomic_read(&kref->refcount) == 1) ||
60 (atomic_dec_and_test(&kref->refcount))) {
61 release(kref); 56 release(kref);
62 return 1; 57 return 1;
63 } 58 }