libyang MAINTENANCE uninit var false positive
diff --git a/src/plugins_types/union.c b/src/plugins_types/union.c
index 6e31d1e..f2682ce 100644
--- a/src/plugins_types/union.c
+++ b/src/plugins_types/union.c
@@ -418,10 +418,10 @@
         void *prefix_data, size_t *value_len)
 {
     void *ret = NULL;
-    LY_ERR retval;
+    LY_ERR r;
     struct ly_err_item *err;
     uint64_t num = 0;
-    uint32_t type_idx;
+    uint32_t type_idx = 0;
     ly_bool dynamic;
     size_t pval_len;
     void *pval;
@@ -435,8 +435,8 @@
         ctx = subvalue->ctx_node->module->ctx;
     }
     subvalue->value.realtype->plugin->free(ctx, &subvalue->value);
-    retval = union_find_type(ctx, type_u->types, subvalue, 0, NULL, NULL, &type_idx, NULL, &err);
-    LY_CHECK_RET((retval != LY_SUCCESS) && (retval != LY_EINCOMPLETE), NULL);
+    r = union_find_type(ctx, type_u->types, subvalue, 0, NULL, NULL, &type_idx, NULL, &err);
+    LY_CHECK_RET((r != LY_SUCCESS) && (r != LY_EINCOMPLETE), NULL);
 
     /* Print subvalue in LYB format. */
     pval = (void *)subvalue->value.realtype->plugin->print(NULL, &subvalue->value, LY_VALUE_LYB, prefix_data, &dynamic,
diff --git a/src/tree_data_new.c b/src/tree_data_new.c
index 752b181..eb67618 100644
--- a/src/tree_data_new.c
+++ b/src/tree_data_new.c
@@ -208,7 +208,7 @@
 lyd_create_anydata_datatree(const struct ly_ctx *ctx, const void *value, LYD_ANYDATA_VALUETYPE value_type,
         struct lyd_node **tree)
 {
-    LY_ERR r;
+    LY_ERR r = LY_SUCCESS;
     struct ly_in *in = NULL;
     struct lyd_ctx *lydctx = NULL;
     uint32_t parse_opts, int_opts;