libyang BUGFIX setting the return code

The return code should be initialized to LY_SUCCESS, and in the case
of an error, the error code should be explicitly set.
diff --git a/src/parser_xml.c b/src/parser_xml.c
index e7f3bbb..f237cdf 100644
--- a/src/parser_xml.c
+++ b/src/parser_xml.c
@@ -70,7 +70,7 @@
 static LY_ERR
 lydxml_metadata(struct lyd_xml_ctx *lydctx, struct lyd_meta **meta)
 {
-    LY_ERR ret = LY_EVALID;
+    LY_ERR ret = LY_SUCCESS;
     const struct lyxml_ns *ns;
     struct lys_module *mod;
     const char *name;
@@ -84,6 +84,7 @@
             /* in XML, all attributes must be prefixed
              * TODO exception for NETCONF filters which are supposed to map to the ietf-netconf without prefix */
             if (lydctx->parse_opts & LYD_PARSE_STRICT) {
+                ret = LY_EVALID;
                 LOGVAL(xmlctx->ctx, LYVE_REFERENCE, "Missing mandatory prefix for XML metadata \"%.*s\".",
                         (int)xmlctx->name_len, xmlctx->name);
                 goto cleanup;
@@ -99,6 +100,7 @@
         /* get namespace of the attribute to find its annotation definition */
         ns = lyxml_ns_get(&xmlctx->ns, xmlctx->prefix, xmlctx->prefix_len);
         if (!ns) {
+            ret = LY_ENOTFOUND;
             /* unknown namespace, XML error */
             LOGVAL(xmlctx->ctx, LYVE_REFERENCE, "Unknown XML prefix \"%.*s\".", (int)xmlctx->prefix_len, xmlctx->prefix);
             goto cleanup;
@@ -107,6 +109,7 @@
         if (!mod) {
             /* module is not implemented or not present in the schema */
             if (lydctx->parse_opts & LYD_PARSE_STRICT) {
+                ret = LY_ENOTFOUND;
                 LOGVAL(xmlctx->ctx, LYVE_REFERENCE,
                         "Unknown (or not implemented) YANG module with namespace \"%s\" for metadata \"%.*s%s%.*s\".",
                         ns->uri, (int)xmlctx->prefix_len, xmlctx->prefix, xmlctx->prefix_len ? ":" : "",
@@ -131,8 +134,6 @@
         LY_CHECK_GOTO(ret = lyxml_ctx_next(xmlctx), cleanup);
     }
 
-    ret = LY_SUCCESS;
-
 cleanup:
     if (ret) {
         lyd_free_meta_siblings(*meta);