[lttng-dev] [PATCH lttng-modules] Fix: atomic_add_unless() already returns zero on overflow
Francis Deslauriers
francis.deslauriers at efficios.com
Wed Mar 8 04:36:00 UTC 2017
Signed-off-by: Francis Deslauriers <francis.deslauriers at efficios.com>
---
wrapper/kref.h | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/wrapper/kref.h b/wrapper/kref.h
index eedefbf..f30a9ae 100644
--- a/wrapper/kref.h
+++ b/wrapper/kref.h
@@ -36,11 +36,7 @@
*/
static inline int lttng_kref_get(struct kref *kref)
{
- if (atomic_add_unless(&kref->refcount, 1, INT_MAX) != INT_MAX) {
- return 1;
- } else {
- return 0;
- }
+ return atomic_add_unless(&kref->refcount, 1, INT_MAX);
}
#endif /* _LTTNG_WRAPPER_KREF_H */
--
2.7.4
More information about the lttng-dev
mailing list