From 3faba6d46e33b942f525ebaf77f11bc868e5bd76 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Mon, 24 Jul 2017 18:01:56 -0400 Subject: [PATCH] Fix: mixed enums used in source.ctf.fs MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Found by Coverity: CID 1376187 (#3 of 3): Inferred misuse of enum (MIXED_ENUMS) mixed_enums: Mixing enum types enum bt_component_status and enum bt_value_status for ret. Signed-off-by: Mathieu Desnoyers Signed-off-by: Jérémie Galarneau --- plugins/ctf/fs-src/fs.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/plugins/ctf/fs-src/fs.c b/plugins/ctf/fs-src/fs.c index 413198a7..12099ec4 100644 --- a/plugins/ctf/fs-src/fs.c +++ b/plugins/ctf/fs-src/fs.c @@ -1319,7 +1319,8 @@ struct ctf_fs_component *ctf_fs_create(struct bt_private_component *priv_comp, struct ctf_fs_component *ctf_fs; struct bt_value *value = NULL; const char *path_param; - int ret; + enum bt_component_status ret; + enum bt_value_status value_ret; ctf_fs = g_new0(struct ctf_fs_component, 1); if (!ctf_fs) { @@ -1327,7 +1328,7 @@ struct ctf_fs_component *ctf_fs_create(struct bt_private_component *priv_comp, } ret = bt_private_component_set_user_data(priv_comp, ctf_fs); - assert(ret == 0); + assert(ret == BT_COMPONENT_STATUS_OK); /* * We don't need to get a new reference here because as long as @@ -1340,8 +1341,8 @@ struct ctf_fs_component *ctf_fs_create(struct bt_private_component *priv_comp, goto error; } - ret = bt_value_string_get(value, &path_param); - assert(ret == 0); + value_ret = bt_value_string_get(value, &path_param); + assert(value_ret == BT_VALUE_STATUS_OK); BT_PUT(value); value = bt_value_map_get(params, "clock-class-offset-s"); if (value) { @@ -1349,9 +1350,9 @@ struct ctf_fs_component *ctf_fs_create(struct bt_private_component *priv_comp, BT_LOGE("clock-class-offset-s should be an integer"); goto error; } - ret = bt_value_integer_get(value, + value_ret = bt_value_integer_get(value, &ctf_fs->metadata_config.clock_class_offset_s); - assert(ret == 0); + assert(value_ret == BT_VALUE_STATUS_OK); BT_PUT(value); } @@ -1361,9 +1362,9 @@ struct ctf_fs_component *ctf_fs_create(struct bt_private_component *priv_comp, BT_LOGE("clock-class-offset-ns should be an integer"); goto error; } - ret = bt_value_integer_get(value, + value_ret = bt_value_integer_get(value, &ctf_fs->metadata_config.clock_class_offset_ns); - assert(ret == 0); + assert(value_ret == BT_VALUE_STATUS_OK); BT_PUT(value); } @@ -1378,8 +1379,7 @@ struct ctf_fs_component *ctf_fs_create(struct bt_private_component *priv_comp, goto error; } - ret = create_ctf_fs_traces(ctf_fs, path_param); - if (ret) { + if (create_ctf_fs_traces(ctf_fs, path_param)) { goto error; } @@ -1389,7 +1389,7 @@ error: ctf_fs_destroy(ctf_fs); ctf_fs = NULL; ret = bt_private_component_set_user_data(priv_comp, NULL); - assert(ret == 0); + assert(ret == BT_COMPONENT_STATUS_OK); end: bt_put(value); -- 2.34.1