Fix: atomic_long_add_unless() returns a boolean
[lttng-modules.git] / lttng-abi.c
index a57e5e9f2acb699c899bba2fc2e1ccc5797be053..223c1ee4a5224ee3c723f1e6eae92c9d328850c7 100644 (file)
@@ -430,8 +430,8 @@ int lttng_abi_create_channel(struct file *session_file,
                transport_name = "<unknown>";
                break;
        }
-       if (atomic_long_add_unless(&session_file->f_count,
-               1, INT_MAX) == INT_MAX) {
+       if (!atomic_long_add_unless(&session_file->f_count, 1, LONG_MAX)) {
+               ret = -EOVERFLOW;
                goto refcount_error;
        }
        /*
@@ -1039,8 +1039,7 @@ int lttng_abi_create_event(struct file *channel_file,
                goto file_error;
        }
        /* The event holds a reference on the channel */
-       if (atomic_long_add_unless(&channel_file->f_count,
-               1, INT_MAX) == INT_MAX) {
+       if (!atomic_long_add_unless(&channel_file->f_count, 1, LONG_MAX)) {
                ret = -EOVERFLOW;
                goto refcount_error;
        }
This page took 0.023218 seconds and 4 git commands to generate.