On error path, use `goto`.
Reported by Coverity:
CID
1475805: Unused value (UNUSED_VALUE)
Assigning value LTTNG_ERR_UNK to ret_code here, but that stored value is overwritten before it can be used.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ife3b5486b8463242dfecb61a3a9718e8eb7149b4
channel = trace_ust_channel_to_lttng_channel(uchan);
if (!channel) {
- ret = LTTNG_ERR_NOMEM;
- break;
+ ret_code = LTTNG_ERR_NOMEM;
+ goto end;
}
extended = (struct lttng_channel_extended *)
if (ret < 0) {
lttng_channel_destroy(channel);
ret_code = LTTNG_ERR_UNK;
- break;
+ goto end;
}
extended->discarded_events = discarded_events;
ERR("Failed to serialize lttng_channel: channel name = '%s'",
channel->name);
ret_code = LTTNG_ERR_UNK;
- ret = -1;
- break;
+ goto end;
}
i++;