tree data REFACTOR variable reuse
diff --git a/src/tree_data_common.c b/src/tree_data_common.c
index 68a67ec..677a8e7 100644
--- a/src/tree_data_common.c
+++ b/src/tree_data_common.c
@@ -816,8 +816,8 @@
     opaq = (struct lyd_node_opaq *)node;
     parent = lyd_parent(node);
 
-    if (lyd_parent(node)) {
-        LOG_LOCSET(NULL, lyd_parent(node), NULL, NULL);
+    if (parent) {
+        LOG_LOCSET(NULL, parent, NULL, NULL);
         ++loc_node;
     } else {
         LOG_LOCSET(NULL, NULL, "/", NULL);