From: Mathieu Desnoyers Date: Fri, 5 Nov 2021 19:08:07 +0000 (-0400) Subject: Fix: _lttng_kernel_event_create never returns NULL X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=c3fb484e598a4c08aa096901b611af7311ad77ca;p=lttng-modules.git Fix: _lttng_kernel_event_create never returns NULL Handle _lttng_kernel_event_create return value as IS_ERR. It is never NULL. Signed-off-by: Mathieu Desnoyers Change-Id: Iaae2b632b7a11084403740c1849fe101bdca2472 --- diff --git a/src/lttng-abi.c b/src/lttng-abi.c index cd946656..c0ab0a48 100644 --- a/src/lttng-abi.c +++ b/src/lttng-abi.c @@ -1926,7 +1926,7 @@ int lttng_abi_create_event(struct file *channel_file, * will stay invariant for the rest of the session. */ event = lttng_kernel_event_create(&event_enabler->parent, NULL); - WARN_ON_ONCE(!event); + WARN_ON_ONCE(IS_ERR(event)); lttng_event_enabler_destroy(&event_enabler->parent); if (IS_ERR(event)) { ret = PTR_ERR(event); @@ -2163,7 +2163,7 @@ int lttng_abi_create_event_notifier(struct file *event_notifier_group_file, goto event_notifier_error; } event = lttng_kernel_event_create(&event_notifier_enabler->parent, NULL); - WARN_ON_ONCE(!event); + WARN_ON_ONCE(IS_ERR(event)); lttng_event_enabler_destroy(&event_notifier_enabler->parent); if (IS_ERR(event)) { ret = PTR_ERR(event); diff --git a/src/lttng-events.c b/src/lttng-events.c index b787b95c..d3532b3d 100644 --- a/src/lttng-events.c +++ b/src/lttng-events.c @@ -2103,7 +2103,7 @@ void lttng_event_enabler_create_tracepoint_events_if_missing(struct lttng_event_ * We need to create an event for this event probe. */ event = _lttng_kernel_event_create(event_enabler, desc); - if (!event) { + if (IS_ERR(event)) { printk(KERN_INFO "LTTng: Unable to create event %s\n", probe_desc->event_desc[i]->event_name); } diff --git a/src/lttng-syscalls.c b/src/lttng-syscalls.c index e432da0d..2e832413 100644 --- a/src/lttng-syscalls.c +++ b/src/lttng-syscalls.c @@ -568,9 +568,9 @@ void lttng_syscall_event_enabler_create_event(struct lttng_event_enabler_common if (!event_recorder_enabler) return; event = _lttng_kernel_event_create(&event_recorder_enabler->parent, desc); - WARN_ON_ONCE(!event || IS_ERR(event)); + WARN_ON_ONCE(IS_ERR(event)); lttng_event_enabler_destroy(&event_recorder_enabler->parent); - if (!event || IS_ERR(event)) { + if (IS_ERR(event)) { printk(KERN_INFO "Unable to create event recorder %s\n", desc->event_name); return; } @@ -618,9 +618,9 @@ void lttng_syscall_event_enabler_create_event(struct lttng_event_enabler_common &event_notifier_param, syscall_event_notifier_enabler->group); WARN_ON_ONCE(!event_notifier_enabler); event = _lttng_kernel_event_create(&event_notifier_enabler->parent, desc); - WARN_ON_ONCE(!event || IS_ERR(event)); + WARN_ON_ONCE(IS_ERR(event)); lttng_event_enabler_destroy(&event_notifier_enabler->parent); - if (!event || IS_ERR(event)) { + if (IS_ERR(event)) { printk(KERN_INFO "Unable to create event notifier %s\n", desc->event_name); return; }