validation BUGFIX final validation of specific module data only

Refs sysrepo/sysrepo#2437
diff --git a/src/validation.c b/src/validation.c
index 282899a..c2026e1 100644
--- a/src/validation.c
+++ b/src/validation.c
@@ -1331,7 +1331,7 @@
 
     /* validate all restrictions of nodes themselves */
     LY_LIST_FOR_SAFE(first, next, node) {
-        if (mod && (lyd_owner_module(node) != mod)) {
+        if (!node->parent && mod && (lyd_owner_module(node) != mod)) {
             /* all top-level data from this module checked */
             break;
         }
@@ -1372,6 +1372,11 @@
     LY_CHECK_RET(lyd_validate_siblings_schema_r(first, parent, sparent, mod ? mod->compiled : NULL, val_opts, int_opts));
 
     LY_LIST_FOR(first, node) {
+        if (!node->parent && mod && (lyd_owner_module(node) != mod)) {
+            /* all top-level data from this module checked */
+            break;
+        }
+
         /* validate all children recursively */
         LY_CHECK_RET(lyd_validate_final_r(lyd_child(node), node, node->schema, NULL, val_opts, int_opts));