xpath CHANGE refactor schema warnings
diff --git a/src/xpath.c b/src/xpath.c
index 580f477..ec0f3d3 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -3195,7 +3195,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_bit_is_set(struct lyxp_set **args, uint16_t UNUSED(arg_count), struct lyxp_set *set, int options)
@@ -3209,22 +3209,17 @@
     if (options & LYXP_SCNODE_ALL) {
         if ((args[0]->type != LYXP_SET_SCNODE_SET) || !(sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
             LOGWRN(set->ctx, "Argument #1 of %s not a node-set as expected.", __func__);
-            rc = LY_EINVAL;
         } else if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
             LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-            rc = LY_EINVAL;
         } else if (!warn_is_specific_type(sleaf->type, LY_TYPE_BITS)) {
             LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of type \"bits\".", __func__, sleaf->name);
-            rc = LY_EINVAL;
         }
 
         if ((args[1]->type == LYXP_SET_SCNODE_SET) && (sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[1]))) {
             if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
                 LOGWRN(set->ctx, "Argument #2 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-                rc = LY_EINVAL;
             } else if (!warn_is_string_type(sleaf->type)) {
                 LOGWRN(set->ctx, "Argument #2 of %s is node \"%s\", not of string-type.", __func__, sleaf->name);
-                rc = LY_EINVAL;
             }
         }
         set_scnode_clear_ctx(set);
@@ -3264,7 +3259,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_boolean(struct lyxp_set **args, uint16_t UNUSED(arg_count), struct lyxp_set *set, int options)
@@ -3291,7 +3286,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_ceiling(struct lyxp_set **args, uint16_t UNUSED(arg_count), struct lyxp_set *set, int options)
@@ -3302,13 +3297,10 @@
     if (options & LYXP_SCNODE_ALL) {
         if ((args[0]->type != LYXP_SET_SCNODE_SET) || !(sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
             LOGWRN(set->ctx, "Argument #1 of %s not a node-set as expected.", __func__);
-            rc = LY_EINVAL;
         } else if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
             LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-            rc = LY_EINVAL;
         } else if (!warn_is_specific_type(sleaf->type, LY_TYPE_DEC64)) {
             LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of type \"decimal64\".", __func__, sleaf->name);
-            rc = LY_EINVAL;
         }
         set_scnode_clear_ctx(set);
         return rc;
@@ -3333,7 +3325,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_concat(struct lyxp_set **args, uint16_t arg_count, struct lyxp_set *set, int options)
@@ -3350,10 +3342,8 @@
                 if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
                     LOGWRN(set->ctx, "Argument #%u of %s is a %s node \"%s\".",
                            i + 1, __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-                    rc = LY_EINVAL;
                 } else if (!warn_is_string_type(sleaf->type)) {
                     LOGWRN(set->ctx, "Argument #%u of %s is node \"%s\", not of string-type.", __func__, i + 1, sleaf->name);
-                    rc = LY_EINVAL;
                 }
             }
         }
@@ -3391,7 +3381,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_contains(struct lyxp_set **args, uint16_t UNUSED(arg_count), struct lyxp_set *set, int options)
@@ -3403,20 +3393,16 @@
         if ((args[0]->type == LYXP_SET_SCNODE_SET) && (sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
             if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
                 LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-                rc = LY_EINVAL;
             } else if (!warn_is_string_type(sleaf->type)) {
                 LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of string-type.", __func__, sleaf->name);
-                rc = LY_EINVAL;
             }
         }
 
         if ((args[1]->type == LYXP_SET_SCNODE_SET) && (sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[1]))) {
             if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
                 LOGWRN(set->ctx, "Argument #2 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-                rc = LY_EINVAL;
             } else if (!warn_is_string_type(sleaf->type)) {
                 LOGWRN(set->ctx, "Argument #2 of %s is node \"%s\", not of string-type.", __func__, sleaf->name);
-                rc = LY_EINVAL;
             }
         }
         set_scnode_clear_ctx(set);
@@ -3445,7 +3431,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_count(struct lyxp_set **args, uint16_t UNUSED(arg_count), struct lyxp_set *set, int options)
@@ -3456,7 +3442,6 @@
     if (options & LYXP_SCNODE_ALL) {
         if ((args[0]->type != LYXP_SET_SCNODE_SET) || !(scnode = warn_get_scnode_in_ctx(args[0]))) {
             LOGWRN(set->ctx, "Argument #1 of %s not a node-set as expected.", __func__);
-            rc = LY_EINVAL;
         }
         set_scnode_clear_ctx(set);
         return rc;
@@ -3484,7 +3469,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_current(struct lyxp_set **args, uint16_t arg_count, struct lyxp_set *set, int options)
@@ -3516,7 +3501,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_deref(struct lyxp_set **args, uint16_t UNUSED(arg_count), struct lyxp_set *set, int options)
@@ -3534,14 +3519,11 @@
     if (options & LYXP_SCNODE_ALL) {
         if ((args[0]->type != LYXP_SET_SCNODE_SET) || !(sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
             LOGWRN(set->ctx, "Argument #1 of %s not a node-set as expected.", __func__);
-            rc = LY_EINVAL;
         } else if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
             LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-            rc = LY_EINVAL;
         } else if (!warn_is_specific_type(sleaf->type, LY_TYPE_LEAFREF) && !warn_is_specific_type(sleaf->type, LY_TYPE_INST)) {
             LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of type \"leafref\" nor \"instance-identifier\".",
                    __func__, sleaf->name);
-            rc = LY_EINVAL;
         }
         set_scnode_clear_ctx(set);
         if ((rc == LY_SUCCESS) && (sleaf->type->basetype == LY_TYPE_LEAFREF)) {
@@ -3609,7 +3591,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_derived_from(struct lyxp_set **args, uint16_t UNUSED(arg_count), struct lyxp_set *set, int options)
@@ -3625,22 +3607,17 @@
     if (options & LYXP_SCNODE_ALL) {
         if ((args[0]->type != LYXP_SET_SCNODE_SET) || !(sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
             LOGWRN(set->ctx, "Argument #1 of %s not a node-set as expected.", __func__);
-            rc = LY_EINVAL;
         } else if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
             LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-            rc = LY_EINVAL;
         } else if (!warn_is_specific_type(sleaf->type, LY_TYPE_IDENT)) {
             LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of type \"identityref\".", __func__, sleaf->name);
-            rc = LY_EINVAL;
         }
 
         if ((args[1]->type == LYXP_SET_SCNODE_SET) && (sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[1]))) {
             if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
                 LOGWRN(set->ctx, "Argument #2 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-                rc = LY_EINVAL;
             } else if (!warn_is_string_type(sleaf->type)) {
                 LOGWRN(set->ctx, "Argument #2 of %s is node \"%s\", not of string-type.", __func__, sleaf->name);
-                rc = LY_EINVAL;
             }
         }
         set_scnode_clear_ctx(set);
@@ -3697,7 +3674,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_derived_from_or_self(struct lyxp_set **args, uint16_t UNUSED(arg_count), struct lyxp_set *set, int options)
@@ -3713,22 +3690,17 @@
     if (options & LYXP_SCNODE_ALL) {
         if ((args[0]->type != LYXP_SET_SCNODE_SET) || !(sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
             LOGWRN(set->ctx, "Argument #1 of %s not a node-set as expected.", __func__);
-            rc = LY_EINVAL;
         } else if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
             LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-            rc = LY_EINVAL;
         } else if (!warn_is_specific_type(sleaf->type, LY_TYPE_IDENT)) {
             LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of type \"identityref\".", __func__, sleaf->name);
-            rc = LY_EINVAL;
         }
 
         if ((args[1]->type == LYXP_SET_SCNODE_SET) && (sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[1]))) {
             if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
                 LOGWRN(set->ctx, "Argument #2 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-                rc = LY_EINVAL;
             } else if (!warn_is_string_type(sleaf->type)) {
                 LOGWRN(set->ctx, "Argument #2 of %s is node \"%s\", not of string-type.", __func__, sleaf->name);
-                rc = LY_EINVAL;
             }
         }
         set_scnode_clear_ctx(set);
@@ -3788,7 +3760,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_enum_value(struct lyxp_set **args, uint16_t UNUSED(arg_count), struct lyxp_set *set, int options)
@@ -3800,13 +3772,10 @@
     if (options & LYXP_SCNODE_ALL) {
         if ((args[0]->type != LYXP_SET_SCNODE_SET) || !(sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
             LOGWRN(set->ctx, "Argument #1 of %s not a node-set as expected.", __func__);
-            rc = LY_EINVAL;
         } else if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
             LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-            rc = LY_EINVAL;
         } else if (!warn_is_specific_type(sleaf->type, LY_TYPE_ENUM)) {
             LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of type \"enumeration\".", __func__, sleaf->name);
-            rc = LY_EINVAL;
         }
         set_scnode_clear_ctx(set);
         return rc;
@@ -3837,7 +3806,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_false(struct lyxp_set **UNUSED(args), uint16_t UNUSED(arg_count), struct lyxp_set *set, int options)
@@ -3859,7 +3828,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_floor(struct lyxp_set **args, uint16_t UNUSED(arg_count), struct lyxp_set *set, int UNUSED(options))
@@ -3883,7 +3852,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_lang(struct lyxp_set **args, uint16_t UNUSED(arg_count), struct lyxp_set *set, int options)
@@ -3899,10 +3868,8 @@
         if ((args[0]->type == LYXP_SET_SCNODE_SET) && (sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
             if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
                 LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-                rc = LY_EINVAL;
             } else if (!warn_is_string_type(sleaf->type)) {
                 LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of string-type.", __func__, sleaf->name);
-                rc = LY_EINVAL;
             }
         }
         set_scnode_clear_ctx(set);
@@ -3983,7 +3950,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_last(struct lyxp_set **UNUSED(args), uint16_t UNUSED(arg_count), struct lyxp_set *set, int options)
@@ -4014,7 +3981,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_local_name(struct lyxp_set **args, uint16_t arg_count, struct lyxp_set *set, int options)
@@ -4085,7 +4052,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_name(struct lyxp_set **args, uint16_t arg_count, struct lyxp_set *set, int options)
@@ -4257,7 +4224,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_node(struct lyxp_set **UNUSED(args), uint16_t UNUSED(arg_count), struct lyxp_set *set, int options)
@@ -4282,7 +4249,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_normalize_space(struct lyxp_set **args, uint16_t arg_count, struct lyxp_set *set, int options)
@@ -4297,10 +4264,8 @@
         if (arg_count && (args[0]->type == LYXP_SET_SCNODE_SET) && (sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
             if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
                 LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-                rc = LY_EINVAL;
             } else if (!warn_is_string_type(sleaf->type)) {
                 LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of string-type.", __func__, sleaf->name);
-                rc = LY_EINVAL;
             }
         }
         set_scnode_clear_ctx(set);
@@ -4374,7 +4339,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_not(struct lyxp_set **args, uint16_t UNUSED(arg_count), struct lyxp_set *set, int options)
@@ -4402,7 +4367,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_number(struct lyxp_set **args, uint16_t arg_count, struct lyxp_set *set, int options)
@@ -4434,7 +4399,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_position(struct lyxp_set **UNUSED(args), uint16_t UNUSED(arg_count), struct lyxp_set *set, int options)
@@ -4469,7 +4434,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_re_match(struct lyxp_set **args, uint16_t UNUSED(arg_count), struct lyxp_set *set, int options)
@@ -4484,20 +4449,16 @@
         if ((args[0]->type == LYXP_SET_SCNODE_SET) && (sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
             if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
                 LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-                rc = LY_EINVAL;
             } else if (!warn_is_string_type(sleaf->type)) {
                 LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of string-type.", __func__, sleaf->name);
-                rc = LY_EINVAL;
             }
         }
 
         if ((args[1]->type == LYXP_SET_SCNODE_SET) && (sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[1]))) {
             if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
                 LOGWRN(set->ctx, "Argument #2 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-                rc = LY_EINVAL;
             } else if (!warn_is_string_type(sleaf->type)) {
                 LOGWRN(set->ctx, "Argument #2 of %s is node \"%s\", not of string-type.", __func__, sleaf->name);
-                rc = LY_EINVAL;
             }
         }
         set_scnode_clear_ctx(set);
@@ -4548,7 +4509,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_round(struct lyxp_set **args, uint16_t UNUSED(arg_count), struct lyxp_set *set, int options)
@@ -4559,13 +4520,10 @@
     if (options & LYXP_SCNODE_ALL) {
         if ((args[0]->type != LYXP_SET_SCNODE_SET) || !(sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
             LOGWRN(set->ctx, "Argument #1 of %s not a node-set as expected.", __func__);
-            rc = LY_EINVAL;
         } else if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
             LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-            rc = LY_EINVAL;
         } else if (!warn_is_specific_type(sleaf->type, LY_TYPE_DEC64)) {
             LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of type \"decimal64\".", __func__, sleaf->name);
-            rc = LY_EINVAL;
         }
         set_scnode_clear_ctx(set);
         return rc;
@@ -4596,7 +4554,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_starts_with(struct lyxp_set **args, uint16_t UNUSED(arg_count), struct lyxp_set *set, int options)
@@ -4608,20 +4566,16 @@
         if ((args[0]->type == LYXP_SET_SCNODE_SET) && (sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
             if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
                 LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-                rc = LY_EINVAL;
             } else if (!warn_is_string_type(sleaf->type)) {
                 LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of string-type.", __func__, sleaf->name);
-                rc = LY_EINVAL;
             }
         }
 
         if ((args[1]->type == LYXP_SET_SCNODE_SET) && (sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[1]))) {
             if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
                 LOGWRN(set->ctx, "Argument #2 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-                rc = LY_EINVAL;
             } else if (!warn_is_string_type(sleaf->type)) {
                 LOGWRN(set->ctx, "Argument #2 of %s is node \"%s\", not of string-type.", __func__, sleaf->name);
-                rc = LY_EINVAL;
             }
         }
         set_scnode_clear_ctx(set);
@@ -4650,7 +4604,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_string(struct lyxp_set **args, uint16_t arg_count, struct lyxp_set *set, int options)
@@ -4682,7 +4636,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_string_length(struct lyxp_set **args, uint16_t arg_count, struct lyxp_set *set, int options)
@@ -4694,19 +4648,15 @@
         if (arg_count && (args[0]->type == LYXP_SET_SCNODE_SET) && (sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
             if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
                 LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-                rc = LY_EINVAL;
             } else if (!warn_is_string_type(sleaf->type)) {
                 LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of string-type.", __func__, sleaf->name);
-                rc = LY_EINVAL;
             }
         }
         if (!arg_count && (set->type == LYXP_SET_SCNODE_SET) && (sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(set))) {
             if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
                 LOGWRN(set->ctx, "Argument #0 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-                rc = LY_EINVAL;
             } else if (!warn_is_string_type(sleaf->type)) {
                 LOGWRN(set->ctx, "Argument #0 of %s is node \"%s\", not of string-type.", __func__, sleaf->name);
-                rc = LY_EINVAL;
             }
         }
         set_scnode_clear_ctx(set);
@@ -4737,7 +4687,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_substring(struct lyxp_set **args, uint16_t arg_count, struct lyxp_set *set, int options)
@@ -4751,20 +4701,16 @@
         if ((args[0]->type == LYXP_SET_SCNODE_SET) && (sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
             if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
                 LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-                rc = LY_EINVAL;
             } else if (!warn_is_string_type(sleaf->type)) {
                 LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of string-type.", __func__, sleaf->name);
-                rc = LY_EINVAL;
             }
         }
 
         if ((args[1]->type == LYXP_SET_SCNODE_SET) && (sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[1]))) {
             if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
                 LOGWRN(set->ctx, "Argument #2 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-                rc = LY_EINVAL;
             } else if (!warn_is_numeric_type(sleaf->type)) {
                 LOGWRN(set->ctx, "Argument #2 of %s is node \"%s\", not of numeric type.", __func__, sleaf->name);
-                rc = LY_EINVAL;
             }
         }
 
@@ -4772,10 +4718,8 @@
                     && (sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[2]))) {
             if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
                 LOGWRN(set->ctx, "Argument #3 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-                rc = LY_EINVAL;
             } else if (!warn_is_numeric_type(sleaf->type)) {
                 LOGWRN(set->ctx, "Argument #3 of %s is node \"%s\", not of numeric type.", __func__, sleaf->name);
-                rc = LY_EINVAL;
             }
         }
         set_scnode_clear_ctx(set);
@@ -4838,7 +4782,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_substring_after(struct lyxp_set **args, uint16_t UNUSED(arg_count), struct lyxp_set *set, int options)
@@ -4851,20 +4795,16 @@
         if ((args[0]->type == LYXP_SET_SCNODE_SET) && (sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
             if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
                 LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-                rc = LY_EINVAL;
             } else if (!warn_is_string_type(sleaf->type)) {
                 LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of string-type.", __func__, sleaf->name);
-                rc = LY_EINVAL;
             }
         }
 
         if ((args[1]->type == LYXP_SET_SCNODE_SET) && (sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[1]))) {
             if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
                 LOGWRN(set->ctx, "Argument #2 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-                rc = LY_EINVAL;
             } else if (!warn_is_string_type(sleaf->type)) {
                 LOGWRN(set->ctx, "Argument #2 of %s is node \"%s\", not of string-type.", __func__, sleaf->name);
-                rc = LY_EINVAL;
             }
         }
         set_scnode_clear_ctx(set);
@@ -4895,7 +4835,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_substring_before(struct lyxp_set **args, uint16_t UNUSED(arg_count), struct lyxp_set *set, int options)
@@ -4908,20 +4848,16 @@
         if ((args[0]->type == LYXP_SET_SCNODE_SET) && (sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
             if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
                 LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-                rc = LY_EINVAL;
             } else if (!warn_is_string_type(sleaf->type)) {
                 LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of string-type.", __func__, sleaf->name);
-                rc = LY_EINVAL;
             }
         }
 
         if ((args[1]->type == LYXP_SET_SCNODE_SET) && (sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[1]))) {
             if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
                 LOGWRN(set->ctx, "Argument #2 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-                rc = LY_EINVAL;
             } else if (!warn_is_string_type(sleaf->type)) {
                 LOGWRN(set->ctx, "Argument #2 of %s is node \"%s\", not of string-type.", __func__, sleaf->name);
-                rc = LY_EINVAL;
             }
         }
         set_scnode_clear_ctx(set);
@@ -4951,7 +4887,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_sum(struct lyxp_set **args, uint16_t UNUSED(arg_count), struct lyxp_set *set, int options)
@@ -4971,10 +4907,8 @@
                     if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
                         LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__,
                                lys_nodetype2str(sleaf->nodetype), sleaf->name);
-                        rc = LY_EINVAL;
                     } else if (!warn_is_numeric_type(sleaf->type)) {
                         LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of numeric type.", __func__, sleaf->name);
-                        rc = LY_EINVAL;
                     }
                 }
             }
@@ -5025,7 +4959,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_text(struct lyxp_set **UNUSED(args), uint16_t UNUSED(arg_count), struct lyxp_set *set, int options)
@@ -5078,7 +5012,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_translate(struct lyxp_set **args, uint16_t UNUSED(arg_count), struct lyxp_set *set, int options)
@@ -5093,30 +5027,24 @@
         if ((args[0]->type == LYXP_SET_SCNODE_SET) && (sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[0]))) {
             if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
                 LOGWRN(set->ctx, "Argument #1 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-                rc = LY_EINVAL;
             } else if (!warn_is_string_type(sleaf->type)) {
                 LOGWRN(set->ctx, "Argument #1 of %s is node \"%s\", not of string-type.", __func__, sleaf->name);
-                rc = LY_EINVAL;
             }
         }
 
         if ((args[1]->type == LYXP_SET_SCNODE_SET) && (sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[1]))) {
             if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
                 LOGWRN(set->ctx, "Argument #2 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-                rc = LY_EINVAL;
             } else if (!warn_is_string_type(sleaf->type)) {
                 LOGWRN(set->ctx, "Argument #2 of %s is node \"%s\", not of string-type.", __func__, sleaf->name);
-                rc = LY_EINVAL;
             }
         }
 
         if ((args[2]->type == LYXP_SET_SCNODE_SET) && (sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[2]))) {
             if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
                 LOGWRN(set->ctx, "Argument #3 of %s is a %s node \"%s\".", __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
-                rc = LY_EINVAL;
             } else if (!warn_is_string_type(sleaf->type)) {
                 LOGWRN(set->ctx, "Argument #3 of %s is node \"%s\", not of string-type.", __func__, sleaf->name);
-                rc = LY_EINVAL;
             }
         }
         set_scnode_clear_ctx(set);
@@ -5182,7 +5110,7 @@
  * @param[in] arg_count Count of elements in @p args.
  * @param[in,out] set Context and result set at the same time.
  * @param[in] options XPath options.
- * @return LY_ERR (LY_EINVAL for wrong arguments on schema)
+ * @return LY_ERR
  */
 static LY_ERR
 xpath_true(struct lyxp_set **UNUSED(args), uint16_t UNUSED(arg_count), struct lyxp_set *set, int options)
@@ -7057,7 +6985,7 @@
 {
     LY_ERR rc;
     LY_ERR (*xpath_func)(struct lyxp_set **, uint16_t, struct lyxp_set *, int) = NULL;
-    uint16_t arg_count = 0, i, func_exp = *exp_idx;
+    uint16_t arg_count = 0, i;
     struct lyxp_set **args = NULL, **args_aux;
 
     if (set) {
@@ -7244,13 +7172,6 @@
         rc = xpath_func(args, arg_count, set, options);
 
         if (options & LYXP_SCNODE_ALL) {
-            if (rc == LY_EINVAL) {
-                /* some validation warning TODO log everything immediately? */
-                LOGWRN(set->ctx, "Previous warning generated by XPath function \"%.*s\".",
-                       (exp->tok_pos[*exp_idx - 1] - exp->tok_pos[func_exp]) + 1, &exp->expr[exp->tok_pos[func_exp]]);
-                rc = LY_SUCCESS;
-            }
-
             /* merge all nodes from arg evaluations */
             for (i = 0; i < arg_count; ++i) {
                 set_scnode_clear_ctx(args[i]);