Fix: provide more precise error report for enable event
[lttng-modules.git] / lttng-abi.c
index a373504c26d0d7804e22cafb4e0dcac3747212a9..1cc9510110dbc216ecf02c4ca8157dfc8f12a78e 100644 (file)
@@ -43,6 +43,7 @@
 #include <linux/file.h>
 #include <linux/uaccess.h>
 #include <linux/slab.h>
+#include <linux/err.h>
 #include "wrapper/vmalloc.h"   /* for wrapper_vmalloc_sync_all() */
 #include "wrapper/ringbuffer/vfs.h"
 #include "wrapper/ringbuffer/backend.h"
@@ -912,8 +913,9 @@ int lttng_abi_create_event(struct file *channel_file,
                 * will stay invariant for the rest of the session.
                 */
                event = lttng_event_create(channel, event_param, NULL, NULL);
-               if (!event) {
-                       ret = -EINVAL;
+               WARN_ON_ONCE(!event);
+               if (IS_ERR(event)) {
+                       ret = PTR_ERR(event);
                        goto event_error;
                }
                event_file->private_data = event;
This page took 0.02329 seconds and 4 git commands to generate.