aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/dtc/fstree.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/dtc/fstree.c')
-rw-r--r--scripts/dtc/fstree.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/scripts/dtc/fstree.c b/scripts/dtc/fstree.c
index 766b2694d935..f3774530170a 100644
--- a/scripts/dtc/fstree.c
+++ b/scripts/dtc/fstree.c
@@ -58,10 +58,9 @@ static struct node *read_fstree(const char *dirname)
58 "WARNING: Cannot open %s: %s\n", 58 "WARNING: Cannot open %s: %s\n",
59 tmpnam, strerror(errno)); 59 tmpnam, strerror(errno));
60 } else { 60 } else {
61 prop = build_property(strdup(de->d_name), 61 prop = build_property(xstrdup(de->d_name),
62 data_copy_file(pfile, 62 data_copy_file(pfile,
63 st.st_size), 63 st.st_size));
64 NULL);
65 add_property(tree, prop); 64 add_property(tree, prop);
66 fclose(pfile); 65 fclose(pfile);
67 } 66 }
@@ -69,14 +68,14 @@ static struct node *read_fstree(const char *dirname)
69 struct node *newchild; 68 struct node *newchild;
70 69
71 newchild = read_fstree(tmpnam); 70 newchild = read_fstree(tmpnam);
72 newchild = name_node(newchild, strdup(de->d_name), 71 newchild = name_node(newchild, xstrdup(de->d_name));
73 NULL);
74 add_child(tree, newchild); 72 add_child(tree, newchild);
75 } 73 }
76 74
77 free(tmpnam); 75 free(tmpnam);
78 } 76 }
79 77
78 closedir(d);
80 return tree; 79 return tree;
81} 80}
82 81
@@ -85,8 +84,8 @@ struct boot_info *dt_from_fs(const char *dirname)
85 struct node *tree; 84 struct node *tree;
86 85
87 tree = read_fstree(dirname); 86 tree = read_fstree(dirname);
88 tree = name_node(tree, "", NULL); 87 tree = name_node(tree, "");
89 88
90 return build_boot_info(NULL, tree, 0); 89 return build_boot_info(NULL, tree, guess_boot_cpuid(tree));
91} 90}
92 91